Technical Q&A QA1180

Is dlopen available on all versions of Mac OS X?

Q:  Is dlopen available on all versions of Mac OS X?

A: Prior to version 10.3, dlopen was only available for Mac OS X as a third party library called dlcompat.

In order to better support the compilation of various software projects on Mac OS X, Apple rolled dlcompat into the operating system in Mac OS X 10.3. Then for Mac OS X 10.4, Apple rewrote dlopen and integrated it into the dyld project. Consequently, dlopen, dlclose, dlsym, and dlerror are all implemented using dyld calls.

Software written using a higher level framework in most cases should use the dynamic linking facilities available at that level. Core Foundation provides two mechanisms for dynamically linking to libraries and plug-ins: CFBundle and, layered on top of that, CFPlugIn. Cocoa programmers will probably want to use NSBundle.

Detailed information about using dynamic libraries on Mac OS X can be found in the ADC document "Introduction to Dynamic Library Programming Topics".



Document Revision History


DateNotes
2008-08-19

Fixed broken links.

2006-05-11

Moved to Darwin>Porting category.

2005-12-02

Changed title and content to reflect dlopen's inclusion in Panther and beyond.

2002-08-19

New document that describes how to dynamically link to libraries and plug-ins, typically done with dlopen.