Library (computing): Difference between revisions

Content deleted Content added
Mountain (talk | contribs)
add inter-link to zh.wikipedia.org
No edit summary
Line 44:
== Shared Library ==
Libraries can be linked dynamically. In [[Microsoft Windows]], those are called '''dynamically linked library''', or '''DLL'''. Conventional libraries are often called static library to distinguish from shared libraries.
 
The shared library term is slightly ambiguous, because it covers at least two different concepts. First, it is the sharing of code located on disk by unrelated programs. The second concept is the sharing of code in memory, when programs execute the same physical page of RAM, mapped into different address spaces. RAM sharing can be accomplished by using [[position independent code]] as in [[Unix]], which leads to a complex but flexible architecture, or by using normal, ie. not position independent code like in [[Microsoft Windows]] and [[OS/2]], but making sure, by various tricks like pre-mapping the address space and reserving slots for each DLL, that code has a great probability of being shared. Windows DLLs are not shared libraries in the Unix sense. The rest of this article concentrates on aspects common to both variants.
 
A DLL is a software library (often stored in a [[computer file|file]]) consisting of a collection of resources or routines that are available to other programs. A program that wants to use these routines is linked (see [[linker]]) with the DLL at the time it is actually started or later. Oppose this with a [[static library]], the contents of which are copied into the program when the program is compiled and linked.
Line 55 ⟶ 57:
Executables are less likely to have a symbol table (they are not mandatory and are usually stripped down to save space), as opposed to DLLs which need one to serve their purpose. Aside from that, from most other aspects, the difference between DLLs and executables in modern operating systems is mostly conventional, as the other [[data structures]] are shared between the two types of files. Both have a record pointing at a main entry point. While an executable's main entry point is used by the operating system to launch it, the operating system uses a DLL's main entry point only when it is loaded by some application, to initialize that DLL. In other words, the user of the operating system cannot directly cause the invokation of the main (or indeed any other) entry point of a DLL.
 
The term DLL is mostly used on Windows and [[OS/2]] products. On the UNIX platform, the term ''shared library'' is more commonly used. This is technically justified in view of the different semantics. More explanations are available in the [[position independent code]] article.

In some cases, an operating system can become overloaded with different versions of DLLs, which impedes its performance and stability. Such a scenario is known as [[DLL-hell]].
 
== See also ==