[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: loadlib for Mac OS X
- From: Mike Pall <mikelu-0412@...>
- Date: Tue, 21 Dec 2004 19:50:36 +0100
Hi,
Dario Accornero wrote:
> All NS* APIs on OS X require at least Objective-C support, and most
> require linking against Cocoa as well. On the other hand, CFBundles
> and _dyld_ functions are available to all kinds of OS X applications...
Well, I encountered quite a few difficulties using the CF* and _dyld_*
functions. After some research and a few experiments later I discovered
that the specific NS* APIs for dynamic loading reside in a pure C library
and *do not* use ObjC and *do not* drag in Cocoa (unless the bundle itself
is written in ObjC or uses Cocoa -- which is of course expected).
Tracing the process reveals that only /usr/lib/libSystem.B.dylib and
/usr/lib/system/libmathCommon.A.dylib are loaded (which are the
equivalents of libc and libm on less excentric operating systems).
So unless I get convincing evidence to the contrary I'll stay with
the API currently used in the code. It also seems to be what everone
else is using ('else' being Perl, Python, Ruby and many other open
source projects that have to load plugins).
Roberto Ierusalimschy wrote:
> Ok. But which set of functions should we
> use? NSCreateObjectFileImageFromFile or NSAddImage? Or neither?
NSCreateObjectFileImageFromFile only loads bundles, NSAddImage only
loads dylibs.
During my search for more info on this topic I found a simple workaround
to allow loading bundles and dylibs with the same code. I'll update my
loadlib patch asap.
Bye,
Mike