[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: dependencies between C modules, RTLD_GLOBAL
- From: Jonathan Goble <jcgoble3@...>
- Date: Tue, 12 May 2015 22:16:46 -0400
On Tue, May 12, 2015 at 9:42 PM, Josh Haberman <email@example.com> wrote:
> On Tue, May 12, 2015 at 4:29 PM, Luiz Henrique de Figueiredo
> <firstname.lastname@example.org> wrote:
>> Since Lua 5.2, package.loadlib accepts an optional argument that allows
>> you to use RTLD_GLOBAL. See
>> So the answer is to use package.loadlib directly.
> Since package.loadlib bypasses require(), it seems like this approach
> will involve re-implementing the require() logic? Stuff like checking
> package.preload, splitting LUA_CPATH on ";", looking in each
> directory, etc?
Yes, you'd have to check package.preload, but if not found there,
`package.searchpath(libname, package.cpath)` ought to return the
filename for passing to package.loadlib.
(Note that I'm basing this on a reading of the manual; I've never
actually had a need to do anything like this, so there may be
something here that I'm missing, but I don't think so.)