lua-users home
lua-l archive

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


On Tue, Apr 03, 2007 at 05:48:11PM -0300, Luiz Henrique de Figueiredo wrote:
> > You may need to build a .dylib.
> > 
> >   gcc -dynamiclib
> 
> Actually, I forgot -bundle. This line works:
> 	cc -o random.so -bundle -undefined dynamic_lookup lrandom.o
> But, as you suggested, so does
> 	cc -o random.so -dynamiclib -undefined dynamic_lookup lrandom.o
> 
> The .so created with the first one is smaller. I don't know whether this means
> anything...

If my memory hasn't failed, -dynamiclib creates things that can't be
loaded with NSBundle (the dyld-based stuff in loadlib.c, for example).

The distinction between them in OS X's Mach-O binary format, as far as I
could tell, is that bundles are for libraries loaded programmatically at
runtime ("plugins", lua modules would fit in this category), and that
dynamic libs are linked against an application (dynamically linked, of
course).  dlopen()/ELF makes no such distinction, so maybe dlopen() on
OS X is smoothing over the difference, to help portability.

> Anyway, it seems that using dlopen in Mac OS X 10.4 is ok. Great.
> Again, the correct Makefile line for building Lua to use dlopen is
> 	$(MAKE) all MYCFLAGS="-DLUA_USE_LINUX" MYLIBS="-lreadline"
> 
> but perhaps LUA_USE_LINUX is confusing... (LUA_USE_LINUX just means
> LUA_USE_POSIX, LUA_USE_DLOPEN, and LUA_USE_READLINE).

Maybe it could be renamed to LUA_USE_UNIX, I assume that folks running
on solaris and the *BSDs are also currently using LUA_USE_LINUX, and
gritting their teeth. ;-)

Sam