INF: Possible Causes of L2022, L2029 with Windows and PM Apps

ID Number: Q79155

5.0x 5.10 5.13 5.15 | 5.0x 5.10 5.13 5.15

MS-DOS | OS/2

Summary:

If a function name specified in the EXPORTS section of the module

definition file (.DEF) does not match the actual function name, the

following errors may occur:

error L2022: <name> (alias <internalname>): export undefined

error L2029: <name>: unresolved external

More Information:

The following are situations in which the errors will occur when

linking either Windows or OS/2 PM applications:

1. A window procedure MainWndProc() is defined as _pascal and exported

with the statement "EXPORTS MainWndProc" in the .DEF file. The /NOI

switch is used during the link. Since MainWndProc() was defined as

_pascal, the actual name is MAINWNDPROC(). The /NOI switch has

turned on case sensitivity; therefore, MainWndProc() and

MAINWNDPROC() are not equivalent and the export is undefined.

The workaround is either to remove /NOI from the link line or

change the procedure name to all caps in the .DEF file.

2. A window procedure ClientWndProc() is defined as _cdecl and

exported with the statement "EXPORTS ClientWndProc" in the .DEF

file. Since ClientWndProc() was defined as _cdecl, the actual name

is _ClientWndProc(). ClientWndProc() and _ClientWndProc() are not

equivalent; therefore, the export is undefined.

The workaround is to prepend the underscore to the procedure name

in the .DEF file. Be sure that the case is preserved.

Additional reference words: 5.01.20 5.01.21 5.02 5.03 5.05 5.10

5.13 5.15