Next Page > Hide TOC

Introduction

Contents:

Organization of This Document
See Also


Applications are rarely implemented as a single module of code because operating systems implement much of the functionality applications need in libraries. To develop applications, programmers link their custom code against these libraries to get basic functionality, such as the ability to write to standard output or draw complex images using a graphics card. However, linking to libraries creates large executable files and wastes memory. One way to reduce the file size and memory footprint of applications is to reduce the amount of code that is loaded at application launch. Dynamic libraries address this need; they can be loaded either at application launch time or at runtime. Dynamic libraries provide a way for applications to load code when it’s actually needed.

To load dynamic libraries at runtime, applications should use a set of efficient and portable functions, called dynamic loader compatibility functions. Using these functions ensures that dynamic libraries are loaded in the most efficient way and facilitates the porting of applications from one platform to another.

This document is intended for developers of dynamic libraries and developers who use dynamic libraries in their applications. You should be familiar with the Mac OS, UNIX, Solaris, or Linux operating systems. You should also be an experienced C, C++, or Objective-C programmer.

This document explains how dynamic libraries are loaded at application launch time and how to use the DLC functions, dlopen, dlsym, dladdr, dlclose, and dlerror, to load dynamic libraries at runtime. This document also provides guidelines for developing dynamic libraries to be used by client applications.

This document doesn’t address the needs of Carbon or Cocoa programmers who need to load code packaged in a framework or a bundle at runtime or those who want to learn how to package dynamic libraries into frameworks or bundles. The documents Framework Programming Guide, and Code Loading Programming Topics for Cocoa provide information tailored specifically to Carbon and Cocoa developers.

After reading this document, you will understand how dynamic libraries should be implemented so they can be used effectively by client applications. You will also know how to use the cross-platform DLC functions to load dynamic libraries at runtime.

System software: This content of this document applies to Mac OS X v10.4 and later.

Organization of This Document

This document is comprised by the following articles:

See Also

To complement the information provided in this document, consult the following documents:

You can find further information on dynamic libraries in the following documents:



Next Page > Hide TOC


© 2009 Apple Inc. All Rights Reserved. (Last updated: 2009-02-26)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.