Shared Libraries and dlopen

If you don’t want to use (or can’t use) NSBundle for loading plug-ins, you can load a shared library instead. Loading a shared library does not give you ready access to resources like NSBundle does.

Mac OS X has a choice of API for manually loading bundles and shared libraries. There is the NSModule API, which includes functions such as NSCreateObjectFileImageFromFile(). Prior editions of this book described this mechanism. It has been deprecated in Mac OS X 10.5, and the documentation manpages have been removed. You can find information in the header located at /usr/include/mach-o/dyld.h.

dlopen()

dlopen() is used to open a shared library or a bundle at a given path:

void* dlopen (const char* path, int mode);

dlopen() ...

Get Advanced Mac OS X Programming: The Big Nerd Ranch Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.