Writing shared libraries

(C) 2004 Mike Hearn

This document is intended to describe best practices for writing shared libraries on Free ELF-based operating systems such as Linux and the BSD family. By following these guidelines, your libraries will be easier to use for other developers, more robust and will cause minimum hassle for end users running applications built upon them.

Throughout this document, XXX will stand for the name of your library, Y will stand for the major version and Z will stand for the minor version. See below for an explanation of major and minor versions.

  1. Versioning
  2. Backwards compatibility and interface management
  3. Namespacing
  4. Config scripts


Backwards compatibility and interface management


Config scripts

Although this guide may seem a bit scary, don't be put off from writing shared libraries! Writing reusable libraries of code is a fantastic way of contributing to the open source community, and by following the guidelines given above you can ensure people benefit to the maximum extent possible.

Have fun!