Properly support visibility

This commit is contained in:
Acedia / Melancholy 2023-02-13 03:10:04 +06:30
parent 6d232bb73c
commit b1673c3087
2 changed files with 56 additions and 0 deletions

View file

@ -4,6 +4,19 @@
#include <stddef.h>
// 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

View file

@ -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