Microsoft KB Archive/79155

= L2022, L2029 Errors Linking Application with a .DEF File =

Article ID: 79155

Article Last Modified on 10/23/2003

-

APPLIES TO


 * Microsoft LINK for MS-DOS 5.0x
 * Microsoft LINK for MS-DOS 5.1x
 * Microsoft LINK for MS-DOS 5.2
 * Microsoft LINK for MS-DOS 5.3x
 * Microsoft LINK for MS-DOS 5.5
 * Microsoft LINK for MS-DOS 5.6
 * Microsoft LINK for OS/2 5.0x
 * Microsoft LINK for OS/2 5.1
 * Microsoft LINK for OS/2 5.11
 * Microsoft LINK for OS/2 5.13
 * Microsoft LINK for OS/2 5.15

-



This article was previously published under Q79155



SYMPTOMS
An attempt to link an application fails and Microsoft LINK generates the following messages

error L2022: (alias ): export undefined

error L2029: : unresolved external



CAUSE
A function name specified in the EXPORTS section of an application's module definition (.DEF) file does not match the actual function name.



RESOLUTION
Modify the function name in the .DEF file to match the name of the function in the code.



MORE INFORMATION
The text below presents two situation in which the errors above occur when Microsoft LINK creates an application for the Microsoft Windows or the OS/2 Presentation Manager operating systems.
 * An application defines a MainWndProc window procedure with the _pascal attribute. The .DEF file contains an &quot;EXPORTS MainWndProc&quot; statement. The LINK command line includes the /NOI[GNORECASE] option switch. Because MainWndProc has the _pascal attribute, its true name is MAINWNDPROC. Further, because the /NOI switch specifies case sensitivity, MainWndProc and MAINWNDPROC are not equivalent and the exported function name is not defined.

To work around this situation, either remove /NOI from the linker command line or modify the .DEF file to specify the function name in upper-case letters.
 * An application defines a ClientWndProc procedure with the _cdecl attribute. The .DEF file contains an &quot;EXPORTS ClientWndProc&quot; statement. Because ClientWndProc has the _cdecl attribute, its true name is _ClientWndProc. ClientWndProc and _ClientWndProc are not equivalent and the export is undefined.

To work around this situation, modify the .DEF file to prepend the procedure name with an underscore. Be sure to preserve the case of the function name in the file.

Additional query words: kbinf 5.01.20 5.01.21 5.02 5.03 5.05 5.10 5.11 5.13 5.15 5.20 5.30 5.31.009 5.50 5.60

Keywords: kb16bitonly KB79155

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.