Share via


Differences Between Win16 and Win32 DLLs

OverviewHow Do IFAQDetailsSample

If you have built 16-bit DLLs for Windows 3.x, you should find that building 32-bit DLLs for Windows 95 and Windows NT 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 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?