Dynamic Link Library (DLL)
DLL do not get loaded in RAM
along with main program all the time. Memory does not get occupied
unnecessarily. But if a DLL file is called by some exe then only it is loaded.
The DLL files have the extension .DLL, .OCX, .DRV. Any DLL file can be called
by an executable (.EXE) file only when it is required.
Advantages of DLL:
I.
Reduce uses of memory.
II.
DLL can be supported by multiple
languages.
III.
If you want to change into function
then there is no need to change into client program.
How the Client Program Finds
a DLL:
If user link explicitly with
LoadLibrary, user can specify the DLL’s full pathname. If user doesn’t specify
the pathname, or if user link implicitly, Windows follows this search sequence
to locate his DLL:
i.
The directory containing the EXE
file
ii.
The process’s current directory
iii.
The Windows system directory
iv.
The Windows directory
v.
The directories listed in the Path
environment variable
Difference between implicit
and explicit linkage:
Implicit Linkage:
a. In
implicit linkage the LIB file is used in which the name of corresponding DLL
name is stored.
b. All
the DLL file get loaded that are associated with particular LIB file.
Explicit Linkage:
a. In
explicit linkage LoadLibrary() function is used in which the path of DLL file
is explicitly mentioned.
b. We
are explicitly specifying the name of required DLL in the LoadLibrary()
function.
MFC DLL s- extension Vs
Regular:
1. Extension
DLL:
It supports a C++ interface so it can export whole classes
and user can instantiate those classes and user can also inherit classes
exported from extension DLL. These types of DLLs are dynamically linked to the
code in the DLL version of the MFC library and the client program must be
dynamically linked to MFC library. Extension DLLs are quite small in size
therefore it loads quickly.
2. Regular
DLL:
It supports only C style function. C++ classes cannot be
exported by regular DLLs but C++ classes can be used inside the regular DLLs.
It is also supported by WIN32 programming environment. It can be linked
statically or dynamically. It is not necessary for the client program to be
dynamically linked to MFC library.
0 comments:
Post a Comment