lua-users home
lua-l archive

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


One trivial way to solve this: stop using the old Mac OS X dynamic loader functionality, and use 'dlopen'. According to the Apple developer documentation 'dlopen' is the preferred way to load modules, and has support in Mac OS X 10.3 and later. In 10.4 it's supposed to be faster than NSLinkModule too. So unless you want to support OS X 10.2.8 there's no pressing reason to keep using NSLinkModule et. al.

I've undefine LUA_USE_DYLD and define LUA_USE_DLOPEN in luaconf.h. This works just fine.


On Apr 2, 2007, at 2:49 PM, 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.

Has anyone else been affected by this, and would it be reason enough to question the use of the PRIVATE flag?

I did read the 8 hits given by the flag name. None of them touch this particular issue. Normally, globals and 'static' in C are common to the process. With the PRIVATE flag, it seems globals are kept separate if the same library is loaded twice.

I tried also gcc -undefined suppress -flat_namespace -bundle but that did not help.

What to do?

-asko


--
Gé Weijers