[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua 5.0 loadlib (on MacOS X)
- From: Thatcher Ulrich <tu@...>
- Date: Fri, 16 May 2003 00:15:45 -0400
On May 15, 2003 at 11:37 -0400, Eli Green wrote:
> On Thursday, May 15, 2003, at 15:42 Canada/Eastern, Asko Kauppi wrote:
>
> >
> >I've got a workin OS X native loadlib.c as well, which I've intended
> >to send to you.
> >
> >It not only adds the native dylib (actually, bundle) support but also
> >allows any C code to access the linkage functions directly. This is
> >necessary for loadmodule etc. addons. Otherwise, we'll end up having N
> >times the same code, and no-one will like that!
>
> What is required by loadmodule? loadlib simply loads a library and
> returns an entry point. From what I've read about loadmodule, any
> version of loadlib that works like the dlopen version should be enough
> for loadmodule to work.
The loadmodule protocol has a versioning call that does not take a
lua_State*; modules are supposed to implement it like this:
const char* luaLM_version(void)
{
return LUA_VERSION;
}
the idea is that an interpreter checks the Lua version that the module
was compiled with, before trying to initialize it and possibly causing
a crash due to a Lua version mismatch.
An interpreter could skip the version check and the module entry point
would still work, provided the Lua versions actually do match. But I
don't think there's any safe way to check that using loadlib alone.
--
Thatcher Ulrich
http://tulrich.com