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
This commit is contained in:
Philipp Janda 2019-02-23 10:32:25 +01:00
parent 144fa01c2f
commit 59c8aaac34

View File

@ -5,6 +5,8 @@
#include "lauxlib.h" #include "lauxlib.h"
#if LUA_VERSION_NUM==501 #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_setfuncs (lua_State *L, const luaL_Reg *l, int nup);
void *luaL_testudata ( lua_State *L, int arg, const char *tname); void *luaL_testudata ( lua_State *L, int arg, const char *tname);
#endif #endif