Science  People  Locations  Timeline
Index: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Home > Library (computer science)


 

In computer science, a library is a collection of subprograms used to develop software. Libraries are distinguished from executables in that they are not independent programs; rather, they are "helper" code that provides services to some other independent program.

Well-known libraries include:

Library linking describes the inclusion of one or more of these software libraries into a new program. There are multiple types of linking: static linking and dynamic linking. These are described below.

1 Static linking

Static linking is linking in which a library is embedded into the program executable at compile time by a linker. A linker is a separate utility which takes one or more libraries and object files (which are previously generated by a compiler or an assembler) and produces an actual executable file.

One of the biggest disadvantages of static linking is that each executable ends up containing its own copy of the library. When many statically linked programs using the same library are simultaneously executed on the same machine, a great deal of memory can be wasted, as each execution loads its own copy of the library's data into memory.

Examples of libraries which are traditionally designed to be statically linked include the ANSI C standard library and the ALIB assembler library . Static linked libraries predate Fortran; Fortran's I/O was designed to use a preexisting package of I/O routines.

2 Dynamic linking

Dynamic linking is linking in which a library is loaded by the operating systemIn computing, an operating system OS is the system software responsible for the direct control and management of hardware and basic system operations, as well as running application software such as word processing programs and web browsers. In general, t's loaderIn computing, a loader is a program that performs the functions of a linker program and then immediately schedules the resulting executable program for action (in the form of a memory image), without necessarily saving the program as an executable file. separately from the executable file at loadtime or runtimeIn computer science, runtime describes the operation of a computer program, the duration of its execution, from beginning to termination (compare compile time). The term is also used as a short form when referring to a runtime library a program or library. The result is called a dynamically linked library.

Most operating systems resolve external dependencies like libraries (called imports) as part of the loading process. For these systems, the executables contain a table called an import directory which is a variable-length array of imports. Each element in the array contains a name of a library. The loader searches the hard disk for the needed library, loads it into memory at an unpredictable location and updates the executable with the library's location in memory. The executable then uses this information to call functions and access data stored in the library. This type of dynamic linking is called loadtime linking and is used by most operating systems including WindowsImage use policy. Microsoft Windows is a range of commercial operating environments for personal computers. The range was first introduced by Microsoft in 1985 and eventually has come to dominate the world personal computer market. All recent versions of and LinuxThis article is about Linux-based operating systems, GNU/Linux, and related topics. See Linux kernel for the kernel itself. See Linux (washing powder) for the Swiss brand of washing powder. Tux, a plump penguin, is the official Linux mascot Linux is the n. Loadtime linking is one of the most complex routines the loader performs while loading an application.

Other operating systems resolve dependencies at runtime. For these systems, the executable calls an operating system API, passing it the name of a library file, a function number within the library and the function's parameters. The operating system resolves the import immediately and calls the appropriate function on behalf of the application. This type of dynamic linking is called runtime linking. Because of the overhead added to each call, runtime linking is incredibly slow and negatively affects an executable's performance. As a result, runtime linking is rarely used by modern operating systems.

In dynamic linking the library, commonly referred to as a dynamic link library (DLL) or shared library, is a pre-compiled and linked executable file which is stored separately on the computer's hard disk. It is loaded only when needed by an application. In most cases, multiple applications can use the same copy of the library at the same time and there is no need for the operating system to load multiple instances of the library into memory concurrently. In these cases, the libraries are stateless. That is, any data which must be stored by the library is stored by the application(s) it is serving. For this reason, these dynamic libraries are considered in-process.

One of the largest disadvantages of dynamic linking is that the executables depend on the separately stored libraries in order to function properly. If the library is deleted, moved, renamed or replaced with an incompatible version, the executable could malfunction. On Windows this is commonly known as DLL-hell.

Dynamic linking libraries date back to at least MTS (the Michigan Terminal System), built in the late 60s. ("A History of MTS", Information Technology Digest, Vol. 5, No. 5)



Read more »

Non User