Building Dynamic Libraries

As the name suggests, a dynamic library (also known as a shared library) is in the first place a library: a collection of object files that have something in common. But unlike a static library, it is dynamic. What’s the difference?

Understanding Dynamic Linking

The first difference between a static library and a dynamic library is in the name. The extension of a dynamic library on Linux/macOS is so (“shared object,” such as libmyjson.so). Microsoft calls them “dynamic linked libraries” with the extension dll, as in libmyjson.dll.

The second difference is in the way a library is linked to the rest of the program. A static library is permanently linked to an executable file, and each process has its copy of the library. ...

Get Resourceful Code Reuse 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.