Encyclopedia > Dynamically linked library

  Article Content

Dynamically linked library

A dynamically linked library, or DLL is a software library (often stored in a 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.

A program performing the former task is called a loader[?], while the latter task is accomplished by a linker. However, to link a program against a DLL, thus making the program request that a particular DLL be loaded when it is started, the linker also needs to look into the DLL to verify that all symbols (routines and variables) used by the program are actually provided by the DLL, thus leaving the impression that dynamic linking is performed at compile time, while it actually happens at run time (in most cases, at program start time).

The process of making resources available to other programs is called exporting. Most common forms of exports include procedures (functions, routines, subroutines), variables, and some sorts of static data, e.g. icons. Exported procedures are also called entry points, because invoking them is akin to "entering" the library. In order to allow access to them, the resources receive names, which are written down inside a table, also containing their offsets inside the file. These names (and sometimes, by analogy, the resources they represent) are called symbols. Similarly, the table is called symbol table.

In most modern operating systems, DLLs are of the same format as the "regular" executables. This allows two main advantages: first, it requires making only one loader for them, rather than two. Secondly, it allows the executables also to be used as DLLs, if they have a symbol table (see below). Typical executable/DLL formats are ELF (UNIX) and PE (Microsoft Windows). In Windows, the concept was taken one step further, even system resources such as fonts being bundled in the DLL file format.

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 products. On the UNIX platform, the term shared library is more commonly used. 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.

All Wikipedia text is available under the terms of the GNU Free Documentation License

  Search Encyclopedia

Search over one million articles, find something about almost anything!
  Featured Article
Intelligence agencies

... Germany Bundesamt fur Verfassungsschutz[?] (BfV, Defunct) Bundesnacrichtendienst[?] (BND) East Germany State Security Service[?] (SSD, ...