WHAT THE LIBRARIES ARE
Libraries are one or more files that together perform a specific function. Libraries exist in various states of composition between source code and binary executable. Binary applications are linked to these libraries using the make utility. In this tutorial, the words compile and build are used interchangeably.
WHERE THE LIBRARIES ARE LOCATED
Common libraries exist for programming purposes (C, Perl etc.) and are often installed in /usr/lib when the operating system is installed. Later installations of software frequently place their binaries in /usr/local/lib or in /etc/lib.
WHAT LIBRARIES DO
Libraries provide the means for the system to perform low level tasks. By separating functions into libraries, they can be called upon by other software and used as part of their functionality. Libraries exist on the system in various states with the extension indicating the state and type of library:
- filename.h - header files - not compiled, not linked; human readable
- filename.c - c source code - not compiled, not linked; human readable
- filename.o - object file - compiled, not linked; not human readable
- filename.so - shared library - compiled, dynamically linked; not human readable
- filename.a - static library - compiled, statically linked; not human readable
HEADER FILES
These are files that contain information about the files contained in a particular library as well as options for compiling the software.
C SOURCE CODE FILES
Nearly all of the software available for Unix is written in a programming language called C. These are the original text files containing human readable sets of instructions.
OBJECT FILES
These are the result of compiling the source code files. These files are later linked together to form a complete, functional executable.
STATIC LIBRARIES
Static libraries are linked in at compile time. Static executables compiled using these libraries contain the libraries within themselves. Thus, statically compiled software contains all the parts it needs to function. This increases the ammount of resources that executable needs. It also requires rebuilding the software whenever new source code is released.
SHARED LIBRARIES (aka DYNAMIC libraries)
Dynamic libraries are separate and can be dynamically loaded and unloaded from memory as needed. Thus, only the libraries need to be recompiled when new source code is released.