diff --git a/include/notcurses/direct.h b/include/notcurses/direct.h index 5447baffe..54b2bc7cc 100644 --- a/include/notcurses/direct.h +++ b/include/notcurses/direct.h @@ -7,6 +7,13 @@ extern "C" { #endif +#ifndef __MINGW64__ +#define API __attribute__((visibility("default"))) +#else +#define API __declspec(dllexport) +#endif +#define ALLOC __attribute__((malloc)) __attribute__((warn_unused_result)) + // ncdirect_init() will call setlocale() to inspect the current locale. If // that locale is "C" or "POSIX", it will call setlocale(LC_ALL, "") to set // the locale according to the LANG environment variable. Ideally, this will @@ -489,6 +496,9 @@ ncdirect_canbraille(const struct ncdirect* nc){ API bool ncdirect_canget_cursor(const struct ncdirect* nc) __attribute__ ((nonnull (1))); +#undef API +#undef ALLOC + #ifdef __cplusplus } #endif diff --git a/include/notcurses/ncport.h b/include/notcurses/ncport.h index 37bdb7a9e..d34daaa35 100644 --- a/include/notcurses/ncport.h +++ b/include/notcurses/ncport.h @@ -12,7 +12,6 @@ extern "C" { #ifndef __MINGW64__ // All but Windows #include -#define API __attribute__((visibility("default"))) #endif #if defined(__linux__) // Linux @@ -32,14 +31,11 @@ extern "C" { #define wcwidth(w) 1 // FIXME lol, no #define wcswidth(w, s) (int)(wcslen(w)) // FIXME lol, no #define htole(x) (x) // FIXME are all windows installs LE? ugh -#define API __declspec(dllexport) #else // BSDs #include #define htole(x) (bswap32(htonl(x))) #endif -#define ALLOC __attribute__((malloc)) __attribute__((warn_unused_result)) - #ifdef __cplusplus } // extern "C" #endif diff --git a/include/notcurses/notcurses.h b/include/notcurses/notcurses.h index 0a0a0db74..cdc7cd785 100644 --- a/include/notcurses/notcurses.h +++ b/include/notcurses/notcurses.h @@ -23,6 +23,13 @@ extern "C" { #define RESTRICT restrict #endif +#ifndef __MINGW64__ +#define API __attribute__((visibility("default"))) +#else +#define API __declspec(dllexport) +#endif +#define ALLOC __attribute__((malloc)) __attribute__((warn_unused_result)) + // Get a human-readable string describing the running Notcurses version. API const char* notcurses_version(void); // Cannot be inline, as we want to get the versions of the actual Notcurses @@ -4129,6 +4136,9 @@ API uint32_t ncdirect_getc(struct ncdirect* nc, const struct timespec *ts, const void* unused, ncinput* ni) __attribute__ ((nonnull (1))) __attribute__ ((deprecated)); +#undef API +#undef ALLOC + #ifdef __cplusplus } // extern "C" #endif diff --git a/src/lib/internal.h b/src/lib/internal.h index 07e7861fd..831e9ccc5 100644 --- a/src/lib/internal.h +++ b/src/lib/internal.h @@ -12,6 +12,13 @@ extern "C" { #include "notcurses/notcurses.h" #include "notcurses/direct.h" +#ifndef __MINGW64__ +#define API __attribute__((visibility("default"))) +#else +#define API __declspec(dllexport) +#endif +#define ALLOC __attribute__((malloc)) __attribute__((warn_unused_result)) + // KEY_EVENT is defined by both ncurses.h and wincon.h. since we don't use // either definition, kill it before inclusion of ncurses.h. #undef KEY_EVENT @@ -1784,6 +1791,9 @@ emit_scrolls(const tinfo* ti, int count, fbuf* f){ // replace or populate the TERM environment variable with 'termname' int putenv_term(const char* termname) __attribute__ ((nonnull (1))); +#undef API +#undef ALLOC + #ifdef __cplusplus } #endif