Hardware Reference
In-Depth Information
All subsequent references to that procedure will be executed without causing a
linkage fault, for the indirect word now contains a valid virtual address. Conse-
quently, the dynamic linker is invoked only the first time a procedure is called.
Dynamic Linking in Windows
All versions of the Windows operating system support dynamic linking and
rely heavily on it. Dynamic linking uses a special file format called a DLL
( Dynamic Link Library ). DLLs can contain procedures, data, or both. They are
commonly used to allow two or more processes to share library procedures or data.
Many DLLs have extension .dll , but other extensions are also in use, including .drv
(for driver libraries) and .fon (for font libraries).
The most common form of a DLL is a library consisting of a collection of pro-
cedures that can be loaded into memory and accessed by multiple processes at the
same time. Figure 7-18 illustrates two processes sharing a DLL file that contains
four procedures, A , B , C , and D . Program 1 uses procedure A ; program 2 uses pro-
cedure C , although they could equally well have used the same procedure.
User process 1
User process 2
DLL
Header
A
B
C
D
Figure 7-18. Use of a DLL file by two processes.
A DLL is constructed by the linker from a collection of input files. In fact,
building a DLL file is very much like building an executable binary program,
except that a special flag is given to the linker to tell it to make a DLL. DLLs are
commonly constructed from collections of library procedures that are likely to be
needed by multiple processes. The interface procedures to the Windows system
call library and large graphics libraries are common examples of DLLs. The ad-
vantage o using DLLs is saving space in memory and on disk. If some common li-
 
Search WWH ::




Custom Search