KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q79155: L2022, L2029 Errors Linking Application with a .DEF File

Article: Q79155
Product(s): Microsoft Programming Utilities
Version(s): MS-DOS:5.0x,5.1x,5.2,5.3x,5.5,5.6; OS/2:5.0x,5.1,5.11,5.13,5.15
Operating System(s): 
Keyword(s): kb16bitonly
Last Modified: 24-DEC-1999

-------------------------------------------------------------------------------
The information in this article applies to:

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

SYMPTOMS
========

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

  error L2022: <name> (alias <internalname>): export undefined
  error L2029: <name>: 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 "EXPORTS MainWndProc" 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 "EXPORTS ClientWndProc" 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 
Technology        : kbAudDeveloper kbZNotKeyword3 kbLINKSearch kbLINK50xDOSSearch kbLINK510xDOSSearch kbLINK530xDOSSearch kbLINK50xOS2Search kbLINK520DOS kbLINK550DOS kbLINK560DOS kbLINK510OS2 kbLINK511OS2 kbLINK513OS2 kbLINK515OS2
Version           : MS-DOS:5.0x,5.1x,5.2,5.3x,5.5,5.6; OS/2:5.0x,5.1,5.11,5.13,5.15

=============================================================================

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.

Copyright Microsoft Corporation 1986-2002.