|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
Differences Between Win16 and Win32 DLLs
If you have built 16-bit DLLs for Windows 3.x, you should find that building 32-bit DLLs is more convenient. The compiler offers more direct support, which can save you several steps in DLL creation. The specific differences between Win16 and Win32 DLLs are:
- 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 of the DLL's static data, including objects.
- You no longer need the function called LibMain or a WEP (Windows Exit Procedure). Where you add initialization and termination code for your DLL depends on the kind 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.
What do you want to do?
What do you want to know more about?
- The different kinds of DLLs available with Visual C++
- Importing and exporting
- Run-time library behavior