Dear Devs,
Sorry if this is not the best place for reporting bugs.
I'm trying to use the lpeglabel library written in C and delivered as lpeglabel.so.
$ ls
testlabel.lua lpeglabel.so
$ cat testlabel.lua
require("lpeglabel")
The ConTeXt binary cannot load the library because it lacks certain Lua API:
$ context --forcecld --permitloadlib testlabel.lua
...
fatal lua error:
registered function call [1542]: ...tx/tex/texmf-context/tex/context/base/mkiv/l-package.lua:348: error loading module 'lpeglabel' from file './lpeglabel.so':
./lpeglabel.so: undefined symbol: lua_gettop
...
nor does LuaTeX:
$ luatex -luaonly testlabel.lua
error loading module 'lpeglabel' from file './lpeglabel.so':
./lpeglabel.so: undefined symbol: lua_getiuservalue
It seems that lua_gettop and others are optimized out from the `context` binary, while lua_getiuservalue and others are missing from `luatex`.
I'm not sure if it works but I would suggest adding `__attribute__ ((used))` to the `LUA_API` macro if the binaries are compiled with gcc.
Best,
Sylvain