In programming, a library is a collection of precompiled routines that a program can use. Libraries are useful for storing frequently used routines because you do not need to explicitly link them to every program that uses them. Thus your executable programs will reference the libraries for required information to perform a function.
Libraries can be linked either statically, or dynamically (also known as shared). Static libraries are linked with the executable program at compile time, while shared libraries (dynamic linking) are linked at run time.