[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: loadlib for Mac OS X
- From: Mike Pall <mikelu-0412@...>
- Date: Thu, 23 Dec 2004 16:08:51 +0100
Hi,
Roberto Ierusalimschy wrote:
> > A general loadlib request: Lua 5.1 has an OS-independent wrapper for DL
> > calls. Since I'm in the process of integrating Bruno Haible's av_call
> > into 5.1, I would need the Lua dl functions split up into the dl access
> > and the symbol lookup part.
>
> Another option is for loadlib to cache the DL handle. Whenever you call
> loadlib("bib", "foo") it first looks up whether bib is already loaded,
> and if so reuses the same handle. That way you can call loadlib over the
> same library for diferent functions without reloading the library.
But this will only work with functions that match the lua_CFunction
signature. There is little need to load more than one of these from a
single library.
What the original poster requested is to be able to reuse the loadlib code
to get a generic function pointer that allows calling arbitrary functions
from system libraries. I.e. functions with different call signatures.
That's what ffcall (aka av_call) is for.
And that's where the request to be able to load dylibs on Mac OS X comes from
(because system libraries are dylibs). I don't to committee design, either.
Bye,
Mike