Introduction
Explains how to design, implement, and use dynamic libraries.
Organization of This Document
This document is comprised by the following articles:
Overview of Dynamic Libraries explains what dynamic libraries are and how they are used by apps. It also provides an overview of the OS X dynamic loader and its cross-platform programming interface.
Dynamic Library Design Guidelines explains how to name and export public symbols so that they are easy to use by clients and how to implement static initializers and finalizers. This article also provides tips on how to manage compatibility and dependency issues. Finally, this article lists issues to consider when implementing a dynamic library using C++ or Objective-C.
Dynamic Library Usage Guidelines shows how to correctly load and use dynamic libraries in apps or in other dynamic libraries. It also provides specific details for using C++–based libraries and Objective-C–based libraries.
Creating Dynamic Libraries demonstrates how to develop dynamic libraries so that they are easy to use by developers who want to take advantage of them in their products.
Using Dynamic Libraries describes the process of installing and using dynamic libraries. It also shows how to interpose the functions exported by a dynamic library.
Logging Dynamic Loader Events explains how to turn on dynamic loader logging and identifies the events that can be logged.
Run-Path Dependent Libraries describes how to create run-path dependent libraries and how to use them in executables.
See Also
To complement the information provided in this document, consult the following documents:
Code Size Performance Guidelines focuses on techniques you can use to reduce the size of your code and use memory efficiently by grouping code into modules according to functionality.
“ Executing Mach-O Files ” in Mach-O Programming Topics describes the app-launch process. In particular this article explains how the dynamic loader binds imported symbols and explains the advantages of using a two-level namespace instead of a flat namespace. This article also explains the different storage classes and symbol attributes you can use to control the visibility of a dynamic library’s exported symbols.
“ Loading Code at Runtime ” in Mach-O Programming Topics explains how to package a dynamic library as a framework, which provides features such as resource management and a streamlined versioning model.
You can find further information on dynamic libraries in the following documents:
Framework Programming Guide explains how to package dynamic libraries into frameworks.
Porting UNIX/Linux Applications to OS X explains how to use dynamic libraries (plug-ins) to reduce the amount of platform-specific code in an app.
How to Write Shared Libraries ( http://people.redhat.com/drepper/dsohowto.pdf ) describes in great detail Linux’s shared objects (dynamic libraries) and provides guidelines on the design and implementation of a library’s API and ABI, including compatibility, performance, and security issues.
Next
Copyright © 2012 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2012-07-23