Fix exporting macros for the C99 API (#1204)
* Fix exporting macros for the C99 API when building bgfx as a shared library - now works with MinGW-w64 under windows and also under linux when -fvisibility=hidden is passed to the compiler to hide all symbols by default (which is recommended - it's a good practice) * merged msvc and mingw configurations since mingw supports __declspec as well
This commit is contained in:
parent
f5dea0d1e1
commit
3ad7b43416
@ -13,6 +13,8 @@
|
||||
#include <stdint.h> // uint32_t
|
||||
#include <stdlib.h> // size_t
|
||||
|
||||
#include <bx/platform.h>
|
||||
|
||||
#ifndef BGFX_SHARED_LIB_BUILD
|
||||
# define BGFX_SHARED_LIB_BUILD 0
|
||||
#endif // BGFX_SHARED_LIB_BUILD
|
||||
@ -21,17 +23,21 @@
|
||||
# define BGFX_SHARED_LIB_USE 0
|
||||
#endif // BGFX_SHARED_LIB_USE
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# if BGFX_SHARED_LIB_BUILD
|
||||
# define BGFX_SHARED_LIB_API __declspec(dllexport)
|
||||
# elif BGFX_SHARED_LIB_USE
|
||||
# define BGFX_SHARED_LIB_API __declspec(dllimport)
|
||||
# else
|
||||
# define BGFX_SHARED_LIB_API
|
||||
# endif // BGFX_SHARED_LIB_*
|
||||
#if BX_PLATFORM_WINDOWS
|
||||
# define BGFX_SYMBOL_EXPORT __declspec(dllexport)
|
||||
# define BGFX_SYMBOL_IMPORT __declspec(dllimport)
|
||||
#else
|
||||
# define BGFX_SYMBOL_EXPORT __attribute__((visibility("default")))
|
||||
# define BGFX_SYMBOL_IMPORT
|
||||
#endif // BX_PLATFORM_WINDOWS
|
||||
|
||||
#if BGFX_SHARED_LIB_BUILD
|
||||
# define BGFX_SHARED_LIB_API BGFX_SYMBOL_EXPORT
|
||||
#elif BGFX_SHARED_LIB_USE
|
||||
# define BGFX_SHARED_LIB_API BGFX_SYMBOL_IMPORT
|
||||
#else
|
||||
# define BGFX_SHARED_LIB_API
|
||||
#endif // defined(_MSC_VER)
|
||||
#endif // BGFX_SHARED_LIB_*
|
||||
|
||||
#if defined(__cplusplus)
|
||||
# define BGFX_C_API extern "C" BGFX_SHARED_LIB_API
|
||||
|
Loading…
Reference in New Issue
Block a user