|
12 | 12 | #include <stddef.h> // size_t |
13 | 13 | #include <stdio.h> // FILE |
14 | 14 |
|
| 15 | +#if defined(__GNUC__) |
| 16 | +# define FMT_CVISIBILITY(value) __attribute__((visibility(value))) |
| 17 | +#else |
| 18 | +# define FMT_CVISIBILITY(value) |
| 19 | +#endif |
| 20 | + |
| 21 | +#if !defined(FMT_HEADER_ONLY) && defined(_WIN32) |
| 22 | +# if defined(FMT_LIB_EXPORT) |
| 23 | +# define FMT_CAPI __declspec(dllexport) |
| 24 | +# elif defined(FMT_SHARED) |
| 25 | +# define FMT_CAPI __declspec(dllimport) |
| 26 | +# endif |
| 27 | +#elif defined(FMT_LIB_EXPORT) || defined(FMT_SHARED) |
| 28 | +# define FMT_CAPI FMT_CVISIBILITY("default") |
| 29 | +#endif |
| 30 | +#ifndef FMT_CAPI |
| 31 | +# define FMT_CAPI |
| 32 | +#endif |
| 33 | + |
15 | 34 | #ifdef __cplusplus |
16 | 35 | extern "C" { |
17 | 36 | #endif |
@@ -45,10 +64,10 @@ typedef struct { |
45 | 64 |
|
46 | 65 | enum { fmt_error = -1, fmt_error_invalid_arg = -2 }; |
47 | 66 |
|
48 | | -int fmt_vformat(char* buffer, size_t size, const char* fmt, const fmt_arg* args, |
49 | | - size_t num_args); |
50 | | -int fmt_vprint(FILE* stream, const char* fmt, const fmt_arg* args, |
51 | | - size_t num_args); |
| 67 | +int FMT_CAPI fmt_vformat(char* buffer, size_t size, const char* fmt, |
| 68 | + const fmt_arg* args, size_t num_args); |
| 69 | +int FMT_CAPI fmt_vprint(FILE* stream, const char* fmt, const fmt_arg* args, |
| 70 | + size_t num_args); |
52 | 71 |
|
53 | 72 | #ifdef __cplusplus |
54 | 73 | } |
@@ -92,7 +111,7 @@ static inline fmt_arg fmt_from_ptr(const void* x) { |
92 | 111 | return (fmt_arg){.type = fmt_pointer, .value.pointer = x}; |
93 | 112 | } |
94 | 113 |
|
95 | | -void fmt_unsupported_type(void); |
| 114 | +void FMT_CAPI fmt_unsupported_type(void); |
96 | 115 |
|
97 | 116 | # if !defined(_MSC_VER) || defined(__clang__) |
98 | 117 | typedef signed char fmt_signed_char; |
|
0 commit comments