Comparing Static and Shared Libraries

Now is a good time to review what you have learned, and compare the pros and cons of each type of library.

The Benefits of Static Libraries

Static libraries cannot eliminate duplicated code in the system. However, there are other benefits to using static libraries. Some of these benefits are as follows:

  • Static libraries are simple to use.

  • The executable does not depend on related external components (shared libraries). The executable contains everything it needs.

  • There are no environmental or administrative issues for static libraries.

  • The static library code does not need to be position-independent code.

Enjoying the Ease of Static Linking

Ease of use is often the reason for choices in the early stages ...

Get Advanced UNIX Programming 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.