DOCUMENT:Q116302 29-OCT-1999 [utilities] TITLE :BUG: LINK Generates Incorrect Unresolved External for Pointer PRODUCT :Microsoft Programming Utilities PROD/VER:MS-DOS:5.3,5.31.009,5.5,5.6 OPER/SYS: KEYWORDS:kb16bitonly ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft LINK for MS-DOS, versions 5.3, 5.31.009, 5.5, 5.6 ------------------------------------------------------------------------------- SYMPTOMS ======== Compiling and linking the sample code shown below causes the linker to generate two L2029 error messages. If the code is compiled as C++ source, the linker shows an incorrect parameter list when generating the unresolved external error message for the Test function. If the sample code is compiled as a C++ file, the linker generates the following error message with the incorrect parameter list: error L2029: 'void __near __cdecl Test(unsigned int,char __far*, int __far*,char __far*)' The error message with the correct parameter list would be: error L2029: 'void __near __cdecl Test(unsigned int,char __far*, int __far*,int __far*)' CAUSE ===== When an L2029 error message is generated for a C++ symbol, the linker "undecorates" the symbol name, using the type information encoded as part of the decorated name. It is during this "undecoration" that the incorrect parameter list is generated based on the function's signature. STATUS ====== Microsoft has confirmed this to be a problem with LINK for MS-DOS, versions 5.3, 5.31.009, 5.5, and 5.6. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available. Sample Code ----------- /* Compile options needed: /Tp (must be compiled as C++ source) NOTE: The sample code below is designed to generate two L2029 errors. */ #include extern void Test(UINT,LPSTR,LPINT,LPINT); extern void Test2(LPINT,LPINT,LPSTR,UINT); void main() { char ray[10]; int num; UINT uint=(unsigned)1.0; LPINT iptr; LPSTR cptr; iptr=# cptr=&ray[0]; Test(uint,cptr,iptr,iptr); // L2029 with incorrect parameter Test2(iptr,iptr,cptr,uint); // L2029 with correct parameters } Additional query words: mangled decorated .CPP 5.30 5.50 5.60 ====================================================================== Keywords : kb16bitonly Technology : kbAudDeveloper kbZNotKeyword3 kbLINKSearch kbLINK530DOS kbLINK53109DOS kbLINK550DOS kbLINK560DOS Version : MS-DOS:5.3,5.31.009,5.5,5.6 ============================================================================= 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 1999.