lua-users home
lua-l archive

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


Duh.. Ignore me. I misread luagl.dylib thinking it's libgl.dylib

On 1/17/2012 11:26 AM, Dimiter 'malkia' Stanev wrote:
I had a similar issue when I did ffi bindings for lua/luajit.

I have two ffi bindings -> OpenGL.lua, and glu.lua, and on OSX they both
load the same OpenGL.framework/OpenGL, while on Linux/Windows - the two
separate libs.

On 1/17/2012 10:30 AM, Antonio Scuri wrote:

Hi,

I was testing our modules for Lua 5.2 in MacOSX and notice a strange
behavior on dlopen.

Some of our modules use functions in C of other modules. For instance
luaglu uses C functions from luagl. In MacOSX we cannot link the
luaglu.so
against luagl.so, only if it was luagl.dylib. No problem, you require the
luagl module first, then the luaglu module, and the loader will find
everything. This works just fine in Lua 5.1.

In Lua 5.2, the require of the secondary module fail, only in MacOSX
(tested on 10.6 and 10.7).

Inspecting the code, I changed the following line:

void *lib = dlopen(path, RTLD_NOW | (seeglb ? RTLD_GLOBAL : RTLD_LOCAL));

to (the same as it was in Lua 5.1):

void *lib = dlopen(path, RTLD_NOW);

Then it works.

Maybe I need some extra parameter when linking. Anyone have any idea
what's going on?

Thanks,
Scuri