The Executable and Linking Format (ELF), developed by the Unix System Laboratories, is common in the Unix world. On ELF systems, there is no distinction between shared libraries and loadable modules; shared code can be used as a library for dynamic loading. ELF is the default binary format on Linux, Solaris 2.x, and SVR4. Since these systems cover a large share of the Unix base, most Unix developers have experience on ELF systems. Thus, it may come as a surprise to experienced Unix developers that shared libraries and loadable modules are not the same on Mac OS X. This is because the binary format used in Mac OS X is Mach-O, which is different from ELF.
Mach-O shared libraries have the file type
and the .dylib
(dynamic library) suffix and can be linked to with static linker
flags. So, if you have a shared library named
libcool.dylib, you can link to this library by
specifying the -lcool flag. Although shared
libraries cannot be loaded dynamically as modules, they can be loaded
through the dyld API (see the manpage for
dyld, the dynamic link editor). It is important
to point out that shared libraries cannot be unloaded.
in Mac OS
X, have the file type
. Most Unix-based software ports usually
produce bundles with a
extension, for the sake of
consistency across platforms. Although Apple recommends giving
bundles a .bundle extension, it
You cannot link directly ...