From 3c729ec8699fed6155b7a129f5483d54921bb7dd Mon Sep 17 00:00:00 2001 From: Egor Date: Sun, 19 Jan 2025 21:12:55 +0300 Subject: [PATCH] fix: lua export (#19) * fix: lua export --- luaiconv.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/luaiconv.c b/luaiconv.c index fb84b19..c8b4fd6 100644 --- a/luaiconv.c +++ b/luaiconv.c @@ -39,6 +39,12 @@ #define LIB_VERSION LIB_NAME " 7" #define ICONV_TYPENAME "iconv_t" +#ifdef _WIN32 +#define LUAEXPORT __declspec(dllexport) +#else +#define LUAEXPORT __attribute__((visibility("default"))) +#endif + #if LUA_VERSION_NUM < 501 #error "Unsupported Lua version. You must use Lua >= 5.1" #endif @@ -229,7 +235,7 @@ static const luaL_Reg iconv_funcs[] = { }; -int luaopen_iconv(lua_State *L) +LUAEXPORT int luaopen_iconv(lua_State *L) { luaL_newlib(L, iconv_funcs);