[prev in list] [next in list] [prev in thread] [next in thread]
List: lua-l
Subject: Re: dlopen RTLD_GLOBAL hack
From: William Ahern <william () 25thandClement ! com>
Date: 2013-10-28 20:42:15
Message-ID: 20131028204215.GA19865 () wilbur ! 25thandClement ! com
[Download RAW message or body]
On Sun, Oct 27, 2013 at 09:47:04PM +0100, Philipp Janda wrote:
> Am 27.10.2013 00:29 schröbte William Ahern:
> >
> >[...]
> >
> >One potential gotcha is that this breaks module unloading. Because the
> >second dlopen increments a reference count on the module, when Lua garbage
> >collects the module and calls dlclose there'll still be a reference. Most
> >people don't rely on module unloading, fortunately. Calling dlcose() on the
> >handle immediately after dlopen() might resolve this issue, but I haven't
> >tested it yet.
> >
>
> You could try `RTLD_NOLOAD`. See here[1].
>
> [1]: http://comments.gmane.org/gmane.comp.lang.lua.general/102742.
>
Unfortunately, RTLD_NOLOAD will still increment the reference count if
returning a handle. OS X documents this in their man page, and I just
confirmed with actual code on Linux.
I'm pretty sure simply calling dlclose again will work. But I can't even get
Linux to unload the library at all once a symbol has been retrieved via
global scoping (NULL handle), so it might just be a moot point. If you need
globally scoped bindings it'll never be unloadable, anyhow.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic