Re: [OT] .so vs .dylib
Re: [OT] .so vs .dylib
- Subject: Re: [OT] .so vs .dylib
- From: Bob Ippolito <email@hidden>
- Date: Tue, 20 Apr 2004 21:17:51 -0400
On Apr 20, 2004, at 10:42 AM, Jerry LeVan wrote:
Looking at the man page for ld I sorta get the idea that
.so libraries are sharable but here has to be some promise
made at link time. .dylib appears to be loadable "out of the blue"
Can anyone clarify the difference between these two types of
libraries?
Well on OS X you have various kinds of Mach-O object files, the most
important are the following:
MH_EXECUTE
Represents the executable code and data for a single process. CAN NOT
be linked to with ld. Can NOT be loaded dynamically UNLESS it is
replacing an entire existing process (execve, etc.). These usually
have no extension, are marked "+x" in the filesystem, and live in the
Contents/MacOS/ folder of a bundle. These are the output of ld with no
special flags, or with the -execute flag.
MH_DYLIB
MH_EXECUTABLE, MH_BUNDLE, and MH_DYLIB may link to these with ld. CAN
NOT be removed from a process once loaded, but CAN be loaded
dynamically (via dyld incantations, NSBundle, etc). These usually have
a .dylib extension if they're independent, but have no extension if
they are part of a framework. Sometimes they have other extensions
(.so, .jnilib, etc.). These are the output of ld with the -dylib flag
(or the -dynamic option in libtool).
MH_BUNDLE
CAN NOT be linked to with ld. May only be loaded at runtime (via
CFBundle, NSBundle, or dyld incantations). CAN be loaded and unloaded
(if it does not use the Objective C runtime, anyway) dynamically.
These usually have a .bundle or .so extension, or may be in a plug-in
bundle. Has a bunch of special ld flags such as the new -undefined
dynamic_lookup or -bundle_loader. These are the output of ld with the
-bundle flag.
Please read the man pages for dyld, ld, and Apple's Mach-O Runtime
Architecture and UNIX Porting Guide for more information. You may also
choose to read the dyld source (part of Darwin) or at least the headers
in /usr/include/mach-o/ if you want more enlightenment.
-bob
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.