[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: NSLINKMODULE_OPTION_PRIVATE a problem? (OS X require of a module multiple times)
- From: Sam Roberts <sroberts@...>
- Date: Mon, 2 Apr 2007 12:51:29 -0700
On Mon, Apr 02, 2007 at 09:49:56PM +0300, Asko Kauppi wrote:
> Lua uses NSLINKMODULE_OPTION_PRIVATE flag on OS X for its "require",
> but this causes globals in a module required in two separate Lua
> states NOT to have common globals. I faced this today, and the only
> solution found was removing that flag from loadlib.c.
As a quick fix, have you tried using dlopen() instead? It is recommended
on OS X (by Apple, see http://lua-users.org/wiki/BuildingLua).
Still, I'm a little surprised that the bundle was loaded twice.
Could this be a bug? Isn't package supposed to load the bundle/so/dll
only the first time the module is required, and the other times to use
the previously opened shared library handle, find the luaopen_XX symbol
using that handle, and call it again in the new state?
The package module definitely keeps the load handle around, I don't see
why it shouldn't use it!
Sam