4

Dynamic Linking

4.1 Overview

Dynamic linking, often implemented with dynamically linked libraries (DLL), is a common way to partition applications and subsystems into smaller portions, which can be compiled, tested, reused, managed, deployed, and installed separately. For instance, assuming that a design of an application follows the MVC pattern discussed in Chapter 3, it is sometimes convenient to implement the model as a separate library that can be loaded when necessary. Then, the library can be reused in some other graphical user interface that needs the same functions, for instance, or by applications that integrate the model to a larger context. Furthermore, the use of dynamically linked libraries can also be a way to interact with a given framework, thus allowing a well-defined boundary between two units of software. In particular, extensions and adaptations to an already existing system can often be more elegantly handled using dynamic libraries than with source code, because recompilations of already compiled parts can be avoided and the correct configuration can predominantly be created with binary files.

4.1.1 Motivation

In the sense of program implementation only, it is not usually necessary to divide the program into several libraries or components. However, using dynamically loaded libraries as an implementation technique for allowing several applications to use the same functions has several benefits. In the following, the most important conceptual advantages are ...

Get Programming Mobile Devices: An Introduction for Practitioners now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.