Static library

Static library

In computer science, a static library or statically-linked library is a set of routines, external functions and variables which are resolved in a caller at compile-time and copied into a target application by a compiler, linker, or binder, producing an object file and a stand-alone executable. This executable and the process of compiling it are both known as a static build of the program. Historically, libraries could only be "static".

Static libraries are either merged with other static libraries and object files during building/linking to form a single executable, or they may be loaded at run-time into the address space of the loaded executable at a static memory offset determined at compile-time/link-time.

When static libraries are used to create an executable, its size will be large when compared to an executable which uses dynamic libraries. This is because linking to static libraries includes the actual code for the library function(s)/procedure(s) "with the executable", whether linked at compile-time or at run-time. However, in some cases, linking to static libraries can result in a performance improvement over linking to dynamic libraries; linking to static libraries has also been used to resolve so-called "DLL hell" problems in older versions of Microsoft Windows. But these advantages are not the sole consideration, and many executables (especially those targeting Microsoft Windows) use both static and dynamic libraries.

It is important to note that any static library function can call a function or procedure in another static library. The linker/linking loader/loader handles this the same way as for any "normal" object file.

Static library files may also be linked/loaded at run-time by a linker or linking loader (e.g., the X11 module loader). However, whether such a process can be called "static linking" is controversial.

Creating static libraries in C/C++

Static libraries can be easily created in C or in C++. These two languages provide storage-class specifiers for indicating external or internal linkage, in addition to providing other features.

To create such a library, the exported functions/procedures and other objects variables must be specified for "external linkage" specified (e.g. not use the C "static" keyword).

See [http://publications.gbdirect.co.uk/c_book/chapter4/linkage.html The C Book - Linkage] for more information.

See also

* Dynamic link library (.DLL)
* Library (computer science)
* Linker
* Loader (computing)
* Object file
* Prebinding
* Shared library


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать курсовую

Look at other dictionaries:

  • Library (computing) — This article is about the programming concept. For Windows 7 Libraries, see Features new to Windows 7#Libraries. Illustration of an application which uses libvorbisfile to play an Ogg Vorbis file In computer science, a library is a collection of… …   Wikipedia

  • Static testing — is a form of software testing where the software isn t actually used. This is in contrast to dynamic testing. It is generally not detailed testing, but checks mainly for the sanity of the code, algorithm, or document. It is primarily syntax… …   Wikipedia

  • Static build — A static build is a compiled version of a program which has been statically linked against libraries. In computer science, linking means taking one or more objects generated by compilers and assemble them into a single executable program. The… …   Wikipedia

  • Static Lib — statische Bibliothek unter UNIX, die zur Übersetzungszeit in ein Programm eingebunden wird (mit Endung .a, Gegenteil: Shared Library) …   Acronyms

  • Static Lib — statische Bibliothek unter UNIX, die zur Übersetzungszeit in ein Programm eingebunden wird (mit Endung .a, Gegenteil: Shared Library) …   Acronyms von A bis Z

  • Dynamic-link library — This article is about the OS/2 and Windows implementation. For dynamic linking of libraries in general, see Dynamic linker. Dynamic link library Filename extension .dll Internet media type application/x msd …   Wikipedia

  • AMD Performance Library — The AMD Performance Library (APL) is a high performance optimized library consisting of low level API s for Image processing, Signal processing, JPEG and Video functionality. These API s are programmed with task level parallelization(Multi… …   Wikipedia

  • Shared Library — Routinenbibliothek unter UNIX, die nicht zur Übersetzung, sondern zur Laufzeit von einem Programm angebunden wird (mit Endung .so, Gegenteil: Static Library) …   Acronyms

  • Shared Library — Routinenbibliothek unter UNIX, die nicht zur Übersetzung, sondern zur Laufzeit von einem Programm angebunden wird (mit Endung .so, Gegenteil: Static Library) …   Acronyms von A bis Z

  • Birkenhead Public Library — Infobox Library library name = Birkenhead Public Library Te Whare Matauranga o Birkenhead library location = North Shore, New Zealand established = 1949 num branches = collection size = annual circulation = pop served = 26,000 budget = director …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”