The information in this article applies to:
SYMPTOMS
LoadLibrary fails under Win32s in the following situation:
This problem does not occur under Windows NT or Windows 95. CAUSE
By default, Visual C++ creates a DLL that statically links to the C Run-
time (CRT) using either the LIBC.LIB or LIBCMT.LIB file to resolve external
symbols depending on whether single-threaded (/ML option) or multi-threaded
(/MT option) version was used. This version of the CRT library is not
compatible with Win32s. Problems occur when global data for the CRT is
initialized, because of the shared address space under Windows.
RESOLUTIONUse the /MD (Multithreaded using CRT in a DLL) option when compiling the DLL and add the MSVCRT.LIB import library to the library list. Include the Win32s version of MSVCRT20.DLL or MSVCRT40.DLL which is included in Visual C++ 2.x or 4.x(it is redistributable) in your project. Then the DLL will use the DLL version of the CRT libraries that is compatible with Win32s and the problem will not occur. MORE INFORMATION
When a DLL that uses the CRT is loaded into memory, all global variables
for the DLL and for the CRT libraries are initialized. Under Windows NT and
Windows 95, the application is given its own copy of the global data for
the DLL. When other applications use the same DLL, they each receive their
own copy of the global variables as well. This eliminates conflicts,
because the data is not shared.
Additional query words:
Keywords : kbWin32s |
Last Reviewed: January 14, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |