diff options
| author | Andre Weissflog <floooh@gmail.com> | 2019-06-04 19:46:10 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-06-04 19:46:10 +0200 |
| commit | de7241f95e7146571dd51dacaba5a26103258f54 (patch) | |
| tree | 6381dc61bd1381ada324e3b440accb53f1fa092d /sokol_app.h | |
| parent | 144ee31c2eced52f0c1f5e2c17e931d8a45e5483 (diff) | |
Add SOKOL_DLL support to all headers. (#163)
On Windows, this adds __declspec(dllexport) or __declspec(dllimport) to all function declarations so that the sokol headers can be compiled into a DLL.
Fixes #160 .
Diffstat (limited to 'sokol_app.h')
| -rw-r--r-- | sokol_app.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sokol_app.h b/sokol_app.h index 7ea88184..4e1d0885 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -25,6 +25,14 @@ SOKOL_DEBUG - by default this is defined if _DEBUG is defined + If sokol_app.h is compiled as a DLL, define the following before + including the declaration or implementation: + + SOKOL_DLL + + On Windows, SOKOL_DLL will define SOKOL_API_DECL as __declspec(dllexport) + or __declspec(dllimport) as needed. + Portions of the Windows and Linux GL initialization and event code have been taken from GLFW (http://www.glfw.org/) @@ -389,7 +397,13 @@ #include <stdbool.h> #ifndef SOKOL_API_DECL - #define SOKOL_API_DECL extern +#if defined(_WIN32) && defined(SOKOL_DLL) && defined(SOKOL_IMPL) +#define SOKOL_API_DECL __declspec(dllexport) +#elif defined(_WIN32) && defined(SOKOL_DLL) +#define SOKOL_API_DECL __declspec(dllimport) +#else +#define SOKOL_API_DECL extern +#endif #endif #ifdef __cplusplus |