lua-users home
lua-l archive

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

I've tried to build Lua 5.1.2 under Mac OS X 10.4 to use dlopen and
"make linux" almost works; there is only a small change in the link
flags. The correct macosx line in src/Makefile seems to be:


(In other words, gcc does not like -Wl,-E. It actually does not mind -ldl.)

The question now was: how does one build a .so for Mac OS X in this case?
gcc -shared does not work.

I experimented with my lrandom and, adapting the instrucions at

this built an .so:

 cc -o -undefined dynamic_lookup lrandom.o

However, this .so does not work:
	lua: error loading module 'random' from file './':
	dlsym(0x100dd0, luaopen_random): symbol not found

Sure enough, nm shows that the _luaopen_random is the exported
symbol, not luaopen_random. So I added an "_" to LUA_POF in loadlib.c and
rebuilt Lua, but no luck:
	dlsym(0x100dd0, _luaopen_random): symbol not found

So, what is the correct incantation?