summaryrefslogtreecommitdiff
path: root/sokol_time.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_time.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_time.h')
-rw-r--r--sokol_time.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/sokol_time.h b/sokol_time.h
index 68132c5d..bcfcf489 100644
--- a/sokol_time.h
+++ b/sokol_time.h
@@ -14,6 +14,14 @@
SOKOL_API_DECL - public function declaration prefix (default: extern)
SOKOL_API_IMPL - public function implementation prefix (default: -)
+ If sokol_time.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.
+
void stm_setup();
Call once before any other functions to initialize sokol_time
(this calls for instance QueryPerformanceFrequency on Windows)
@@ -85,7 +93,13 @@
#include <stdint.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