The information in this article applies to:
SYMPTOMSWhen building a dynamic-link library (DLL) with Visual C++, the following linker error can occur:
CAUSEThis error is usually caused by linking with a third-party DLL's import library that publicly exports its WEP (Windows exit procedure) routine. RESOLUTIONAlthough removing the lines EXPORTSfrom your .DEF file may avoid the error, this method is not recommended because there can be problems with Windows calling the WEP (either your own or the WEP provided by the DLL run-time library) when your DLL is unloaded. As stated, the most common cause of this error is linking with another DLL's import library that was built to publicly export a WEP function. If you are linking your DLL with other third-party or in-house import libraries, you may want to examine them closely. If some of these import libraries are yours, you can modify the way they are built so that they don't put their WEP routines into the import library. Either of the following steps will cause a DLL's exported WEP not to be added to its import library:
-or-
-or- -or- Windows libraries, C run-time libraries, third-party DLLsThis ensures that the correct WEP is pulled in from the Windows C run-time libraries (libraries matching the pattern xDLLCEW.LIB). NOTE: It is not recommended that you create your own WEP, rather than exporting the default WEP. DLL termination code should be in an _WEP routine, which the default WEP will call. This is described on page 119 and 120 of the Visual C++ 1.0 "Programming Techniques" manual, and on page 27 and 28 of the Visual C++ 1.0 "C/C++ Version 7.0 Update" manual. If for some reason you must use your own WEP routine, you may want to examine WEP.ASM in the \MSVC\SOURCE\WIN directory. This is the source for the default WEP that is pulled in from the C run-time libraries. In such a WEP, if your application is a C++ application, you need to make sure to call all destructors of global class objects. If you are creating a Microsoft Foundation Class (MFC) libraries version 2.0 DLL, then you can override the CWinApp::ExitInstance() member function to do your termination processing. Additional query words: kbinf 1.00 technote
Keywords : kb16bitonly |
Last Reviewed: December 22, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |