From a8eaa2f2e560547e63c7976960435e1ae23a22b1 Mon Sep 17 00:00:00 2001 From: krasimir Date: Wed, 12 Apr 2017 10:24:56 +0000 Subject: a patch from Bjørnar Luteberget for compatibility with MSVC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/runtime/c/gu/defs.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/runtime/c/gu/defs.h') diff --git a/src/runtime/c/gu/defs.h b/src/runtime/c/gu/defs.h index 51a2293e3..f302481d6 100644 --- a/src/runtime/c/gu/defs.h +++ b/src/runtime/c/gu/defs.h @@ -25,6 +25,24 @@ #ifndef GU_DEFS_H_ #define GU_DEFS_H_ +// MSVC requires explicit export/import of +// symbols in DLLs. CMake takes care of this +// for functions, but not for data/variables. +#if defined(_MSC_VER) +#if defined(COMPILING_GU) +#define GU_API_DATA_DECL __declspec(dllexport) +#define GU_API_DATA __declspec(dllexport) +#else +#define GU_API_DATA_DECL __declspec(dllimport) +#define GU_API_DATA ERROR_NOT_COMPILING_LIBGU +#endif + +#else +#define GU_API_DATA_DECL extern +#define GU_API_DATA +#endif +// end MSVC workaround + #include #include #include @@ -154,7 +172,7 @@ extern void* const gu_null; // Dummy struct used for generic struct pointers typedef struct GuStruct GuStruct; -extern GuStruct* const gu_null_struct; +GU_API_DATA_DECL GuStruct* const gu_null_struct; typedef uintptr_t GuWord; -- cgit v1.2.3