Professional Documents
Culture Documents
DLL Vs Application
Both are executable modules
User View: DLLs cannot be directly executed
System View:
An application can have multiple instances of itself running in the system
simultaneously, whereas a DLL can have only one instance.
An application can own things such as a stack, global memory, file handles, and
a message queue, but a DLL cannot.
Differences Between Win16 and Win32 DLLs
• There is no separate startup module that you have to link with. The DLL
startup sequence is handled directly by C/C++ run-time library code linked into
your DLL.
• The run-time library code initializes any static non-local C++ objects by
calling the appropriate constructors. Each process gets its own copy of all the
DLL's static data, including objects.
• You no longer need the function LibMain or a WEP (Windows Exit
Procedure). Where you add initialization and termination code for your DLL
depends on the type of DLL you are building. Instead of LibMain, you provide
DllMain, which is called for both for both entry and exit.
• You can import and export symbols directly in your source code. If you
use the __declspec(dllexport) attribute (similar to __export in Windows 3.x),
you do not need to use a separate module-definition file for exports.
• Executables that use __declspec(dllimport) to import data, objects, and
functions from a DLL cause the compiler to generate more efficient code.
• The timing of calls to routines registered with atexit can differ.
• In addition to Win32 non-MFC DLLs, Visual C++ offers three kinds of MFC
DLLs.