ELF/Mach-O: Force default visibility for public API functions.

Thanks to Dymphna. #1409
This commit is contained in:
Mike Pall
2025-11-16 19:41:51 +01:00
parent e274fe760d
commit e17ee83326
2 changed files with 4 additions and 0 deletions

View File

@@ -165,6 +165,8 @@ extern "C"
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
__declspec(dllexport) __declspec(dllexport)
#elif (defined(__ELF__) || defined(__MACH__) || defined(__psp2__)) && !((defined(__sun__) && defined(__svr4__)) || defined(__CELLOS_LV2__))
__attribute__((visibility("default")))
#endif #endif
const unsigned char %s%s[] = { const unsigned char %s%s[] = {
]], LJBC_PREFIX, ctx.modname)) ]], LJBC_PREFIX, ctx.modname))

View File

@@ -132,6 +132,8 @@
#else #else
#define LUA_API __declspec(dllimport) #define LUA_API __declspec(dllimport)
#endif #endif
#elif (defined(__ELF__) || defined(__MACH__) || defined(__psp2__)) && !((defined(__sun__) && defined(__svr4__)) || defined(__CELLOS_LV2__))
#define LUA_API extern __attribute__((visibility("default")))
#else #else
#define LUA_API extern #define LUA_API extern
#endif #endif