Library (computing): Difference between revisions

Content deleted Content added
Jor (talk | contribs)
m disambig loader again
m dab Windows
Line 51:
The process of making resources available to other programs is called ''exporting''. Most common forms of exports include ''[[procedure]]s'' ([[function (programming)|functions]], routines, subroutines), ''[[variable]]s'', 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 system]]s, shared libraries can be 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 [[Executable and Linkable Format|ELF]] ([[UNIX]]) and [[Portable Executable|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.