libclod
C library for interacting with NBTs, region files, LOD data and other things.
Loading...
Searching...
No Matches
lib.h
Go to the documentation of this file.
1
9#ifndef LIBCLOD_LIB_H
10#define LIBCLOD_LIB_H
11
12#include <stddef.h>
13#include <stdint.h>
14#include <limits.h>
15
16#if defined(_WIN32)
17 #ifdef CLOD_BUILD_STATIC
18 #define CLOD_API
19 #elifdef CLOD_BUILD_SHARED
20 #define CLOD_API __declspec(dllexport)
21 #else
22 #define CLOD_API __declspec(dllimport)
23 #endif
24#elif defined(__unix__) || defined(__APPLE__)
25 #if CLOD_BUILD_STATIC
26 #define CLOD_API
27 #else
28 #define CLOD_API __attribute__((visibility("default")))
29 #endif
30#endif
31
32#if defined(__GNUC__) // GCC and Clang
33 #define CLOD_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
34 #define CLOD_PRINTF(fmt_arg, var_args) __attribute__((format(printf, fmt_arg, var_args)))
35 #define CLOD_USE_RETURN __attribute__((warn_unused_result))
36 #define CLOD_CONST __attribute__((const))
37 #define CLOD_PURE __attribute__((pure))
38#else
39 #define CLOD_NONNULL(...)
40 #define CLOD_PRINTF(fmt_arg, var_args)
41 #define CLOD_USE_RETURN
42 #define CLOD_CONST
43 #define CLOD_PURE
44#endif
45
46#endif