C (programming Language) - Libraries

Libraries

The C programming language uses libraries as its primary method of extension. In C, a library is a set of functions contained within a single "archive" file. Each library typically has a header file, which contains the prototypes of the functions contained within the library that may be used by a program, and declarations of special data types and macro symbols used with these functions. In order for a program to use a library, it must include the library's header file, and the library must be linked with the program, which in many cases requires compiler flags (e.g., -lm, shorthand for "math library").

The most common C library is the C standard library, which is specified by the ISO and ANSI C standards and comes with every C implementation. (Implementations which target limited environments such as embedded systems may provide only a subset of the standard library.) This library supports stream input and output, memory allocation, mathematics, character strings, and time values. Several separate standard headers (for example, stdio.h) specify the interfaces for these and other standard library facilities.

Another common set of C library functions are those used by applications specifically targeted for Unix and Unix-like systems, especially functions which provide an interface to the kernel. These functions are detailed in various standards such as POSIX and the Single UNIX Specification.

Since many programs have been written in C, there are a wide variety of other libraries available. Libraries are often written in C because C compilers generate efficient object code; programmers then create interfaces to the library so that the routines can be used from higher-level languages like Java, Perl, and Python.

Read more about this topic:  C (programming Language)

Famous quotes containing the word libraries:

    To me, nothing can be more important than giving children books, It’s better to be giving books to children than drug treatment to them when they’re 15 years old. Did it ever occur to anyone that if you put nice libraries in public schools you wouldn’t have to put them in prisons?
    Fran Lebowitz (20th century)

    riding flatcars to Fresno,
    Across the whole country
    Steep towns, flat towns, even New York,
    And oceans and Europe & libraries & galleries
    And the factories they make rubbers in
    Gary Snyder (b. 1930)