lua-users home
lua-l archive

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

On 23 February 2012 15:35, Gaspard Bucher <> wrote:
> The problem is that this is not "normal" behavior for shared libraries (to
> peek inside the running app to get it's code). This can be enabled by adding
> "RTLD_GLOBAL" in loadlib.c with:
> dlopen(path, RTLD_NOW|RTLD_GLOBAL);
> But instead of using a custom lua, I will see if I can remove these
> dependency chains.

I've dealt with this issue already - I want to split up the common
codebase of various modules of lqt (qtcore, qtgui, ...) to a separate
library ( and use it as an entrypoint, so that the user can
write something like:

    require 'lqt' {'core', 'gui'}

However, the problem is that in Lua 5.1 does not export the
symbols, because it only uses RTLD_NOW, and the RTLD_GLOBAL not
explicitly written. On Mac OS X, RTLD_GLOBAL is the default, and on
Linux, RTLD_LOCAL is the default.

In Python, it is possible to change the way dlopen() works from script
[1]. Lua 5.2 allows you to use package.loadlib with '*' as a second
parameter to force RTLD_GLOBAL [2][3].

[3] - see the first
ll_load() function