lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




On Thu, Feb 23, 2012 at 10:46 PM, Michal Kottman <k0mpjut0r@gmail.com> wrote:
On 23 February 2012 22:36, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
> It must be opened with '*' first. Lua keeps the result of the first
> 'dlopen' for a library and reuses it for other calls. But it may be
> a good idea to separate those auxiliary functions into a C library
> that has no Lua function (and no 'luaopen_' function), so it is never
> 'require'd.

This is what I was suspecting. First I wanted to bundle the "loader"
functions in the shared library itself, but finally I realized that
the only really working way is to have a pure shared library
(liblqt.so), and a "loader" Lua script - lqt.lua, which will handle
things like dependencies between modules. This way "require 'lqt'"
would still work as I imagined.


Thanks everyone for the pointers. I will first try to externalize dependencies in Lua (like move msgpack encoding from inside zeromq socket to Lua wrapper) but if this does not work for some libraries, I will probably end up doing the same as Michal.

Michal, please let us know if you implement this chained loading and how you solve it.

Cheers,


                                                               Gaspard