WEP and Link Error L2023 Export Imported

Last reviewed: July 23, 1997
Article ID: Q102644
3.10 WINDOWS kbprg

The information in this article applies to:

  • Microsoft Windows Software Development Kit (SDK) for Windows, version 3.1

SUMMARY

LINK error L2023 is caused by an incorrect library link order. The linker resolves external references in order of appearance of the libraries, choosing the first occurrence of a label. This error occurs when a dynamic- link library (DLL) exports the routine Windows exit procedure (WEP) that will be brought in from the C Run-time library static .OBJs, but the linker finds another DLL's WEP in its .LIB file because it appears BEFORE the C Run-time library.

It would be best if DLL import libraries didn't include the WEP. This is possible by using the PRIVATE keyword in you .DEF file when exporting your WEP. Or, edit the .LIB via the LIB.EXE utility to remove the WEP reference.

MORE INFORMATION

If the MFC libraries are used, they should be included before any other libraries. As for the other libraries, the Windows libraries should be included first (that is, LIBW, COMMDLG, SHELL, and so forth), the C Run- time second (that is, xLIBCyW.LIB for applications or xDLLCyW.LIB for DLLs), and any additional third-party libraries last (that is, your own or other's .LIBs). For example, when linking a small model DLL that uses another DLL's routines via an import library, the library order would be "LIBW.LIB SDLLCEW.LIB OTHERDLL.LIB". The order should be changed only if a DLL routine was to replace one of the routines in the Windows libraries or CRT.


Additional reference words: 3.10
KBCategory: kbprg
KBSubcategory: KrDll
Keywords : kb16bitonly


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 23, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.