aboutsummaryrefslogtreecommitdiff
path: root/sokol_args.h
diff options
context:
space:
mode:
authorAndre Weissflog <floooh@gmail.com>2020-11-28 14:42:12 +0100
committerAndre Weissflog <floooh@gmail.com>2020-11-28 14:42:12 +0100
commitfad0bf816dd94b8f55a8aa85b1746cce752589e2 (patch)
tree2e80333b284d3d43f8c124cc297f843faf37fdcd /sokol_args.h
parent78dd4e284027d9cdd9437c800bc4af570db8d032 (diff)
parent426c460cc9d02f24a5d25bc8db3564d7a575eeab (diff)
Merge branch 'distinct_export_macros' of https://github.com/iboB/sokol into iboB-distinct_export_macros
Diffstat (limited to 'sokol_args.h')
-rw-r--r--sokol_args.h40
1 files changed, 22 insertions, 18 deletions
diff --git a/sokol_args.h b/sokol_args.h
index 40ee6908..68504d4b 100644
--- a/sokol_args.h
+++ b/sokol_args.h
@@ -15,7 +15,7 @@
SOKOL_LOG(msg) - your own logging functions (default: puts(msg))
SOKOL_CALLOC(n,s) - your own calloc() implementation (default: calloc(n,s))
SOKOL_FREE(p) - your own free() implementation (default: free(p))
- SOKOL_API_DECL - public function declaration prefix (default: extern)
+ SOKOL_ARGS_API_DECL - public function declaration prefix (default: extern)
SOKOL_API_IMPL - public function implementation prefix (default: -)
If sokol_args.h is compiled as a DLL, define the following before
@@ -23,7 +23,7 @@
SOKOL_DLL
- On Windows, SOKOL_DLL will define SOKOL_API_DECL as __declspec(dllexport)
+ On Windows, SOKOL_DLL will define SOKOL_ARGS_API_DECL as __declspec(dllexport)
or __declspec(dllimport) as needed.
OVERVIEW
@@ -247,13 +247,17 @@
#include <stdint.h>
#include <stdbool.h>
-#ifndef SOKOL_API_DECL
+#if defined(SOKOL_API_DECL) && !defined(SOKOL_ARGS_API_DECL)
+ #define SOKOL_ARGS_API_DECL SOKOL_API_DECL
+#endif
+
+#ifndef SOKOL_ARGS_API_DECL
#if defined(_WIN32) && defined(SOKOL_DLL) && defined(SOKOL_IMPL)
-#define SOKOL_API_DECL __declspec(dllexport)
+#define SOKOL_ARGS_API_DECL __declspec(dllexport)
#elif defined(_WIN32) && defined(SOKOL_DLL)
-#define SOKOL_API_DECL __declspec(dllimport)
+#define SOKOL_ARGS_API_DECL __declspec(dllimport)
#else
-#define SOKOL_API_DECL extern
+#define SOKOL_ARGS_API_DECL extern
#endif
#endif
@@ -269,29 +273,29 @@ typedef struct sargs_desc {
} sargs_desc;
/* setup sokol-args */
-SOKOL_API_DECL void sargs_setup(const sargs_desc* desc);
+SOKOL_ARGS_API_DECL void sargs_setup(const sargs_desc* desc);
/* shutdown sokol-args */
-SOKOL_API_DECL void sargs_shutdown(void);
+SOKOL_ARGS_API_DECL void sargs_shutdown(void);
/* true between sargs_setup() and sargs_shutdown() */
-SOKOL_API_DECL bool sargs_isvalid(void);
+SOKOL_ARGS_API_DECL bool sargs_isvalid(void);
/* test if an argument exists by key name */
-SOKOL_API_DECL bool sargs_exists(const char* key);
+SOKOL_ARGS_API_DECL bool sargs_exists(const char* key);
/* get value by key name, return empty string if key doesn't exist */
-SOKOL_API_DECL const char* sargs_value(const char* key);
+SOKOL_ARGS_API_DECL const char* sargs_value(const char* key);
/* get value by key name, return provided default if key doesn't exist */
-SOKOL_API_DECL const char* sargs_value_def(const char* key, const char* def);
+SOKOL_ARGS_API_DECL const char* sargs_value_def(const char* key, const char* def);
/* return true if val arg matches the value associated with key */
-SOKOL_API_DECL bool sargs_equals(const char* key, const char* val);
+SOKOL_ARGS_API_DECL bool sargs_equals(const char* key, const char* val);
/* return true if key's value is "true", "yes" or "on" */
-SOKOL_API_DECL bool sargs_boolean(const char* key);
+SOKOL_ARGS_API_DECL bool sargs_boolean(const char* key);
/* get index of arg by key name, return -1 if not exists */
-SOKOL_API_DECL int sargs_find(const char* key);
+SOKOL_ARGS_API_DECL int sargs_find(const char* key);
/* get number of parsed arguments */
-SOKOL_API_DECL int sargs_num_args(void);
+SOKOL_ARGS_API_DECL int sargs_num_args(void);
/* get key name of argument at index, or empty string */
-SOKOL_API_DECL const char* sargs_key_at(int index);
+SOKOL_ARGS_API_DECL const char* sargs_key_at(int index);
/* get value string of argument at index, or empty string */
-SOKOL_API_DECL const char* sargs_value_at(int index);
+SOKOL_ARGS_API_DECL const char* sargs_value_at(int index);
#ifdef __cplusplus
} /* extern "C" */