Chapter 8. Creating and Using Libraries

Executable binaries can get functions from libraries in one of two ways: The functions can be copied from a static library directly into the executable binary image, or they can be indirectly referenced in a shared library file that is read when the executable is run. This chapter teaches you how to use and create both types of archives.

Static Libraries

Static libraries are simply collections of object files arranged by the ar (archiver) utility. ar collects object files into one archive file and adds a table that tells which object files in the archive define what symbols. The linker, ld, then binds references to a symbol in one object file to the definition of that symbol in an object file in the archive. ...

Get Linux Application Development, Second Edition 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.