16.2) Library Creation And Usage
To create a library of functions, do the following:
- Create a header file containing prototypes for the functions
- Compile the source files containing the functions to object code files
- Bundle the object code files together in a single library archive
To use the library, do the following:
- Install the header file in a standard location
(e.g., /usr/local/include on UNIX-like systems) - Install the library file in a standard location - on UNIX-like systems this could be /usr/local/lib or (on 64-bit machines) /usr/local/lib64
- When compiling a program that needs functions from the library, use the relevant compiler options to tell it where to find the header file and library
Subsequent pages explore these steps in more detail.