I am trying to create a C module to be called from a lua script. I am working on debian linux. I am using mysql-proxy and lua 5.2. I have created (copied from a tutorial) some example functions to be called.
The loader is defined like this:
int luaopen_luacall(lua_State* l)
{
luaL_newlibtable(l, luacall);
luaL_setfuncs(l, luacall, 0);
return 1;
}
To call this from lua I use this code:
luacall = require("luacall")
local f = luacall.fun1()
I have compiled it with this command:
g++ -shared -Wl,-E,-soname,libluacall.so -o luacall.so luacall.c -fPIC -llua -ldl
When I try to run the script I get the following error on the require
command:
error loading module 'luacall' from file '/usr/lib/mysql-proxy/lua/luacall.so':
/usr/lib/mysql-proxy/lua/luacall.so: undefined symbol: luaL_setfuncs
I am really lost on what I am doing wrong.