Libraries
Libraries are groups of code modules organized in a reusable way. This chapter introduces how they are built, reused, and designed.
7.1 |
Code Containers |
170 |
7.2 |
Reusing Other Libraries |
171 |
7.3 |
Organizing Libraries: Dependency Management |
173 |
7.4 |
Installing Libraries: A Lab Exercise |
176 |
7.5 |
Frameworks and Components |
178 |
Libraries generally contain code that has already been designed, tested, and compiled, and can be easily linked into your application. Libraries are essential for making software reuse possible. They can be packaged in a number of different ways, such as
- Source code
- Binary format (dynamic library, shared object, static library, run-time library), called lib for short.
- lib + header files (sometimes referred to as "-dev" or "-devel" packages in Linux package managers)
The lib+header combo allows you to distribute your library without the full source. Others can still compile their apps with it. The binary format can only be used with an app that was already compiled against the library. |
A lib is a file that contains several compiled files (called object files) that are indexed to make it easy for the linker to locate symbols (e.g., names of classes, members, functions, variables, etc.) and their definitions. Packaging these object files in one lib expedites the linking process significantly.
Code Containers
|