C library

From ArticleWorld


A C library is a set of object-code functions, classes and similar structures that help the programmer by implementing very commonly used and/or very difficult to implement functionality.

The C standard library

The most commonly encountered C library is the C standard library. This is the base of the C libraries, dealing with features like file I/O, system-independent memory allocation, basic mathematical functions, string manipulation and definitions etc. The standard C library is standardized by ISO and ANSI.

Unix systems also provide their own libraries, which are standardized as well. Nevertheless, their job is quite different: they provide an interface between the program and the system's kernel. Although they are usually portable between Unix systems, non-Unix systems usually don't support these functions. This happens partly due to the large standard base, as POSIX and the Singe UNIX Specification are not the easiest standards to implement.

Usage outside C

As strange as it may seem, C libraries are not used only in C. Other programming languages use C libraries as well, because C generates very fast object code. Therefore, many languages (like Python, for example) choose to implement an interface that can use C libraries. When this interface is available, the programmer usually writes a higher-level set of functions, that access the underlying C library, thus allowing for some very fast interpretation.