From 59c8aaac3425108e3137677863cc8cee6c84e20b Mon Sep 17 00:00:00 2001 From: Philipp Janda Date: Sat, 23 Feb 2019 10:32:25 +0100 Subject: [PATCH] Fix static linking problem with LuaJIT LuaJIT and LuaSocket both define new Lua APIs from Lua 5.2 (in particular `luaL_setfuncs` and `luaL_testudata`). When linking both statically, the one definition rule strikes and linking fails. This commit fixes the issue by renaming the LuaSocket versions of those functions behind the scenes using the C preprocessor. Closes #214 --- src/compat.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/compat.h b/src/compat.h index e2ab307..49e83f9 100644 --- a/src/compat.h +++ b/src/compat.h @@ -5,6 +5,8 @@ #include "lauxlib.h" #if LUA_VERSION_NUM==501 +#define luaL_setfuncs socket_setfuncs +#define luaL_testudata socket_testudata void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup); void *luaL_testudata ( lua_State *L, int arg, const char *tname); #endif