diff options
author | Philipp Janda <siffiejoe@gmx.net> | 2019-02-23 10:32:25 +0100 |
---|---|---|
committer | Philipp Janda <siffiejoe@gmx.net> | 2019-02-23 10:37:16 +0100 |
commit | 59c8aaac3425108e3137677863cc8cee6c84e20b (patch) | |
tree | d5bab6a927f422525d6d45e2c80dbdc38af2e935 | |
parent | 144fa01c2f204e3b1b13c834f2644d100dba701b (diff) | |
download | luasocket-59c8aaac3425108e3137677863cc8cee6c84e20b.tar.gz luasocket-59c8aaac3425108e3137677863cc8cee6c84e20b.tar.bz2 luasocket-59c8aaac3425108e3137677863cc8cee6c84e20b.zip |
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
-rw-r--r-- | src/compat.h | 2 |
1 files changed, 2 insertions, 0 deletions
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 @@ | |||
5 | #include "lauxlib.h" | 5 | #include "lauxlib.h" |
6 | 6 | ||
7 | #if LUA_VERSION_NUM==501 | 7 | #if LUA_VERSION_NUM==501 |
8 | #define luaL_setfuncs socket_setfuncs | ||
9 | #define luaL_testudata socket_testudata | ||
8 | void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup); | 10 | void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup); |
9 | void *luaL_testudata ( lua_State *L, int arg, const char *tname); | 11 | void *luaL_testudata ( lua_State *L, int arg, const char *tname); |
10 | #endif | 12 | #endif |