diff --git a/Compiler/include/luacode.h b/Compiler/include/luacode.h index 08a207a5..2684461b 100644 --- a/Compiler/include/luacode.h +++ b/Compiler/include/luacode.h @@ -4,6 +4,19 @@ #include // Can be used to export public APIs to DLL +#ifdef _WIN32 +#ifdef __GNUC__ + +#ifdef LUACODE_API_C_EXPORT +#define LUACODE_API extern "C" __attribute__ ((dllexport)) +#endif + +#ifdef LUACODE_API_EXPORT +#define LUACODE_API extern __attribute__ ((dllexport)) +#endif + +#else + #ifdef LUACODE_API_C_EXPORT #define LUACODE_API extern "C" __declspec(dllexport) #endif @@ -12,6 +25,21 @@ #define LUACODE_API extern __declspec(dllexport) #endif +#endif +#else +#if __GNUC__ >= 4 + +#ifdef LUACODE_API_C_EXPORT +#define LUACODE_API extern "C" __attribute__ ((visibility ("default"))) +#endif + +#ifdef LUACODE_API_EXPORT +#define LUACODE_API extern __attribute__ ((visibility ("default"))) +#endif + +#endif +#endif + // Can be used to reconfigure visibility/exports for public APIs #ifndef LUACODE_API #define LUACODE_API extern diff --git a/VM/include/luaconf.h b/VM/include/luaconf.h index fba920e9..f354ec90 100644 --- a/VM/include/luaconf.h +++ b/VM/include/luaconf.h @@ -34,6 +34,19 @@ #endif // Can be used to export public APIs to DLL +#ifdef _WIN32 +#ifdef __GNUC__ + +#ifdef LUA_API_C_EXPORT +#define LUA_API extern "C" __attribute__ ((dllexport)) +#endif + +#ifdef LUA_API_EXPORT +#define LUA_API extern __attribute__ ((dllexport)) +#endif + +#else + #ifdef LUA_API_C_EXPORT #define LUA_API extern "C" __declspec(dllexport) #endif @@ -42,6 +55,21 @@ #define LUA_API extern __declspec(dllexport) #endif +#endif +#else +#if __GNUC__ >= 4 + +#ifdef LUA_API_C_EXPORT +#define LUA_API extern "C" __attribute__ ((visibility ("default"))) +#endif + +#ifdef LUA_API_EXPORT +#define LUA_API extern __attribute__ ((visibility ("default"))) +#endif + +#endif +#endif + // Can be used to reconfigure visibility/exports for public APIs #ifndef LUA_API #define LUA_API extern