The information in this article applies to:
SYMPTOMSPorting your 16-bit application to Win32 results in LINK error LNK2001 (unresolved externals), if a __cdecl function is exported using a module- definition (.DEF) file. The error specifies the function as defined in the .DEF file, with the leading underscore (_) in the name. CAUSE
In 16-bit code, functions are either declared with the __cdecl, __pascal,
or __fastcall conventions. The linker should not resolve a call to a
__cdecl function with a __pascal function, therefore, the compiler
decorates __cdecl names with a leading underscore, converts __pascal names
to all caps, and decorates __fastcall functions with a leading at symbol
(@), so the linker will not make this mistake. It is a requirement that you
put the decorated name in the .DEF file. RESOLUTIONTo work around the problem, update your .DEF file by removing the underscore at the beginning of the file name. If you are maintaining the same sorce code with both Visual C++ for Windows and Visual C++ 32-bit Edition, you must use two .MAK (project) files and two .DEF files, one for each environment. However, the one 32-bit .DEF file will work across all Win32 platforms. STATUSThis behavior is by design. Additional query words:
Keywords : kbtshoot kbVC200 kbVC210 kbVC400 kbVC500 kbVC600 LinkIss |
Last Reviewed: September 16, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |