[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Exporting C functions from an extension module
- From: Hugo Musso Gualandi <hgualandi@...>
- Date: Tue, 19 Apr 2022 13:06:56 +0200
My first choice would be to dynamically link, if at all possible... I have several client modules and I don't want to have multiple copies of mylib in total. First of all, the binaries would get bigger. But a bigger problem would be the possibility of more than one version of mylib at the same time. They wouldn't agree with each other and would be a mess.
To give some more context: the client modules are Pallene modules, which are compiled down to C and turned into a ".so" that can required via the Lua module system. The mylib (aka pallenelib) contains some functionality that every Pallene module needs. I want to make it easier for people to install Pallene and easier to compile their Pallene modules.
Right now, the two avenues that seem most promising to me are:
A) Package and install the pallenelib via Luarocks and tell Pallene modules to require() this library. One challenge is that the library needs to export C symbols, not just Lua functions. Other challenge is that, for technical reasons, pallenelib is only compatible with a specific minor revision of PUC-Lua (e.g. Lua 5.4.4 but not 5.4.3).
B) Create a custom version of the Lua interpreter, statically linked to the pallenelib. This time the challenge is that my users would need to install a custom Lua, separate Luarocks for it , etc...
-- Hugo