lua-users home
lua-l archive

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


On 2012-03-16, Mike Pall <mikelu-1203@mike.de> wrote:
> Miles Bader wrote:
>> Henk Boom <henk@henk.ca> writes:
>> > Why would the luajit ffi be using a different library than the
>> > linker/loader?
>>
>> Presumably luajit searches for libraries in "normal" locations.
>
> It just maps
>   ffi.load("GL")
> to:
>   dlopen("libGL.so", RTLD_LAZY|RTLD_LOCAL)
>
> The FFI has no clue about the actual library paths on POSIX. It
> simply relies on whatever dlopen() does, when called with a path
> without a slash.
>
> I was always under the impression dlopen() behavior is the same as
> implicit dependency loading via ELF headers. Apparently I'm wrong.
> Maybe have a look at readelf -d and at the various environment
> variables related to the dynamic loader.

Interesting, I did a few tests on my system. dlopen("libGL.so"), gives
the wrong library but dlopen("libGL.so.1") and dlopen("GL") (which I
didn't know was valid..) give the right result. Does this make any
sense at all?

It looks like I can get around this by using ffi.load("libGL.so.1")
explicitly, but how portable is that to other linuxes?

    henk