lua-users home
lua-l archive

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



On Jul 3, 2009, at 11:17 AM, Hans van der Meer wrote:

Why does one prescribe for the Mach-O Type the choice "bundle" (mh_bundle) instead of "dynamic library" (mh_dylib). Both seem to work when the result is "require"-ed. Does it matter? Or is there a fundamental difference I am overlooking?

As Asko said, bundle was preferred in very early os x versions.

If your Lua is built to use dlopen it can use bundles or dynamic libraries. Lua uses dlopen when built using
-DLUA_USE_LINUX
or
-DLUA_USE_POSIX
-DLUA_USE_DLOPEN
but not when built using
-DLUA_USE_MACOSX
or
-DLUA_USE_POSIX
-DLUA_DL_DYLD

Note that if you make the macosx Lua Makefile target you get - DLUA_USE_LINUX and therefore dlopen.

Based on the example of other libraries (thanks, Mike Pall), and my reading of http://developer.apple.com/documentation/DeveloperTools/Conceptual/DynamicLibraries/000-Introduction/Introduction.html#/ /apple_ref/doc/uid/TP40001908
my Makefiles use:

gcc -fPIC -dynamiclib -single_module -undefined dynamic_lookup -o xxx.so xxx.o yyy.o

The -single_module option is considered obsolete and is the default since OS X 10.4.0.

http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/ld.1.html

e