Lua and dynamic modules

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Lua and dynamic modules

Lucas Hermann Negri
Hello,

I'm having problems using a Lua module that uses other dynamic modules
(ex.: that uses dlopen or similar). I have a Lua module that is a
binding to a shared library. This shared library uses dlopen(NULL,
someflag) to introspect on its own symbols; when I access it from the
Lua binding module, it doesn't works, but if I force the shared
library to do a dlopen("myfilename", someflag) it works as expected.

Examples are: bindings to GTK+ GtkBuilder and bindings of WebkitGtk
(when it tries to load plugins).

Anyone knows and can share a solution to this problem?

Thanks.

--
http://oproj.tuxfamily.org
Reply | Threaded
Open this post in threaded view
|

Re: Lua and dynamic modules

Asko Kauppi

And the OS was...?

-asko


Lucas Hermann Negri kirjoitti 25.3.2009 kello 2:40:

> Hello,
>
> I'm having problems using a Lua module that uses other dynamic modules
> (ex.: that uses dlopen or similar). I have a Lua module that is a
> binding to a shared library. This shared library uses dlopen(NULL,
> someflag) to introspect on its own symbols; when I access it from the
> Lua binding module, it doesn't works, but if I force the shared
> library to do a dlopen("myfilename", someflag) it works as expected.
>
> Examples are: bindings to GTK+ GtkBuilder and bindings of WebkitGtk
> (when it tries to load plugins).
>
> Anyone knows and can share a solution to this problem?
>
> Thanks.
>
> --
> http://oproj.tuxfamily.org

Reply | Threaded
Open this post in threaded view
|

Re: Lua and dynamic modules

Lucas Hermann Negri
Ops, its on Arch Linux (x86). On Windows XP it works as expected.

On Tue, Mar 24, 2009 at 11:51 PM, Asko Kauppi <[hidden email]> wrote:

>
> And the OS was...?
>
> -asko
>
>
> Lucas Hermann Negri kirjoitti 25.3.2009 kello 2:40:
>
>> Hello,
>>
>> I'm having problems using a Lua module that uses other dynamic modules
>> (ex.: that uses dlopen or similar). I have a Lua module that is a
>> binding to a shared library. This shared library uses dlopen(NULL,
>> someflag) to introspect on its own symbols; when I access it from the
>> Lua binding module, it doesn't works, but if I force the shared
>> library to do a dlopen("myfilename", someflag) it works as expected.
>>
>> Examples are: bindings to GTK+ GtkBuilder and bindings of WebkitGtk
>> (when it tries to load plugins).
>>
>> Anyone knows and can share a solution to this problem?
>>
>> Thanks.
>>
>> --
>> http://oproj.tuxfamily.org
>
>



--
http://oproj.tuxfamily.org
Reply | Threaded
Open this post in threaded view
|

Re: Lua and dynamic modules

Roberto Ierusalimschy
> Ops, its on Arch Linux (x86). On Windows XP it works as expected.

Maybe the problem is the (absence of) RTLD_GLOBAL option. (Search the
list for more information.)

-- Roberto
Reply | Threaded
Open this post in threaded view
|

Re: Lua and dynamic modules

Lucas Hermann Negri
Hello, thanks for the info.

Adding the RTLD_GLOBAL flag on ll_load (in loadlib.c) solves the
problem. Maybe the best approach here is to provide myself a special
loadlib that uses RTLD_GLOBAL? Or there are another non-intrusive
solution?

Thanks.

On Wed, Mar 25, 2009 at 10:38 AM, Roberto Ierusalimschy
<[hidden email]> wrote:
>> Ops, its on Arch Linux (x86). On Windows XP it works as expected.
>
> Maybe the problem is the (absence of) RTLD_GLOBAL option. (Search the
> list for more information.)
>
> -- Roberto
>



--
http://oproj.tuxfamily.org
Reply | Threaded
Open this post in threaded view
|

Re: Lua and dynamic modules

Lucas Hermann Negri
I ended up implementing it as a custom loader in package.loader .

On Wed, Mar 25, 2009 at 6:52 PM, Lucas Hermann Negri <[hidden email]> wrote:

> Hello, thanks for the info.
>
> Adding the RTLD_GLOBAL flag on ll_load (in loadlib.c) solves the
> problem. Maybe the best approach here is to provide myself a special
> loadlib that uses RTLD_GLOBAL? Or there are another non-intrusive
> solution?
>
> Thanks.
>
> On Wed, Mar 25, 2009 at 10:38 AM, Roberto Ierusalimschy
> <[hidden email]> wrote:
>>> Ops, its on Arch Linux (x86). On Windows XP it works as expected.
>>
>> Maybe the problem is the (absence of) RTLD_GLOBAL option. (Search the
>> list for more information.)
>>
>> -- Roberto
>>
>
>
>
> --
> http://oproj.tuxfamily.org
>



--
http://oproj.tuxfamily.org