[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: C module compatibility
- From: Antonin Décimo <antonin.decimo@...>
- Date: Sun, 7 Apr 2019 19:12:05 +0200
I'm working with a library, lua-zip  that is a binding to libzip .
I would like to make sure that the library remains compatible with
Lua 5.1, 5.2, and 5.3, if possible.
lua-zip was written for Lua 5.1, and does not compile under Lua 5.2,
5.3 because the following functions are missing:
lua_equal, luaL_checkint, lua_objlen, luaL_register
I understand that I can use compatibility macros or replace lua_equal,
luaL_checkint, lua_objlen myself, so they are not the problem.
The problem is with luaL_register. With 5.3, it is an alias for
luaL_openlib, that is exported only if LUA_COMPAT_MODULE is defined
during compilation, which neither Debian nor Homebrew seem to do.
So, when I do `local zip = require "brimworks.zip"`, I get this
/usr/local/share/lua/5.3/luarocks/loader.lua:153: error loading module
'brimworks.zip' from file
[C]: in local 'a_loader'
/usr/local/share/lua/5.3/luarocks/loader.lua:153: in function
[C]: in function 'require'
stdin:1: in main chunk
[C]: in ?
What would be a good, and clean way to fix this ? Should I copy/paste
the code from lauxlib? How can I disable this compatibility code if
I'm compiling for 5.2 or lower?
I hope I have everything right.
-- Antonin Décimo