aboutsummaryrefslogtreecommitdiff
path: root/sokol_gfx.h
diff options
context:
space:
mode:
authorAndre Weissflog <floooh@gmail.com>2019-06-04 19:46:10 +0200
committerGitHub <noreply@github.com>2019-06-04 19:46:10 +0200
commitde7241f95e7146571dd51dacaba5a26103258f54 (patch)
tree6381dc61bd1381ada324e3b440accb53f1fa092d /sokol_gfx.h
parent144ee31c2eced52f0c1f5e2c17e931d8a45e5483 (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_gfx.h')
-rw-r--r--sokol_gfx.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/sokol_gfx.h b/sokol_gfx.h
index 4d1a5fdb..db21773b 100644
--- a/sokol_gfx.h
+++ b/sokol_gfx.h
@@ -41,6 +41,14 @@
SOKOL_API_IMPL - public function implementation prefix (default: -)
SOKOL_TRACE_HOOKS - enable trace hook callbacks (search below for TRACE HOOKS)
+ If sokol_gfx.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.
+
If you want to compile without deprecated structs and functions,
define:
@@ -479,7 +487,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