main page, file list, single page HTML, source, report, wiki last updated on 06/07/23


Software library is code that's not meant to run on its own but rather be used by other programs. A library provides resources such as functions, macros, classes or constants that are normally related to solving some specific class of problems, so e.g. there are GUI libraries, audio libraries, mathematical libraries etc. Libraries exist to prevent reinventing wheels by only ever implementing the code once so that next time we can simply reuse it (respecting the DRY principle). Examples of libraries are the standard C library, SDL or JQuery.

If a programmer wants to use a specific library, he has to first install it (if it's not installed already) and then include it in his program with a specific command (words like include, using or import are commonly used). Then he is able to use the resources the library exports. Depending on the type of the library he may also need to link the library code after compilation and possibly distribute the library files along with his program.

You will often hear a library as a certain API -- this is the interface of the library consisting of the elements via which programmer uses the library, mostly the functions the library offers. If a programmer wants to know the library API, he wants to know the names of the functions, what parameters they take etc. Sometimes there may be multiple libraries with the same API but different internal implementations, this is nice because these libraries can be easily drop-in-replaced.

In a specific programming language it IS generally possible to use a library written in a different language, though it may be more difficult to achieve.

We generally divide libraries to two types:

Many times a library can have both static and dynamic version available, or the compiler may allow to automatically link the library as static or dynamic. Then it's up to the programmer which way he wants to go.

C Libraries

LRS Libraries


All content available under CC0 1.0 (public domain). Send comments and corrections to drummyfish at disroot dot org.