FIX: No L2029 Error, "APPLOADER" in Module-Definition File

Last reviewed: September 16, 1997
Article ID: Q87545
5.30 | 5.31 | 5.30 MS-DOS | OS/2 | WINDOWS kbtool kberrmsg kbbuglist kbfixlist

The information in this article applies to:

  • Microsoft LINK for MS-DOS and Windows, version 5.3
  • Microsoft LINK for OS/2, version 5.31

SYMPTOMS

In the Microsoft Windows operating system, an attempt to load an mixed- language program build with Microsoft C/C++ version 7.0 and Microsoft FORTRAN version 5.1 fails and Windows generates a general protection (GP) fault.

CAUSE

The application was built with Microsoft LINK version 5.3 and includes the following statement in its module-definition (.DEF) file:

   APPLOADER '__MSLANGLOAD'

The error occurs when the file contains unresolved externals. Because the internal flag that indicates unresolved externals is overwritten by the routine that resolves the custom loader, no error message occurs when unresolved externals remain nor is the error bit set in the executable file.

RESOLUTION

If Windows version 3.1 is the target operating system, remove the APPLOADER statement from the .DEF file and relink. If Windows version 3.0 is the target operating system, remove the APPLOADER statement from the .DEF file and relink. If no errors occur, edit the .DEF file to place the APPLOADER statement back into the .DEF file and relink.

STATUS

Microsoft has confirmed this to be a problem in LINK version 5.3 for MS-DOS and Windows (distributed with Microsoft C/C++ version 7.0) and LINK version 5.31 for OS/2. This problem was corrected in LINK version 5.31.009 (distributed with the C/C++ version 7.0a patch disk). To obtain the patch disk, obtain a disk from Microsoft. To obtain a disk in the United States, call Microsoft Product Support Services at (206) 454-2030. Outside the United States, contact the Microsoft subsidiary for your area. To locate your subsidiary, go to the Microsoft Web site http://www.microsoft.com/worldwide/default.htm

MORE INFORMATION

The APPLOADER statement in the .DEF file instructs LINK to replace the default loader provided by Windows with a custom loader. The FORTRAN run- time library includes a custom loader called _MSLANGLOAD. This loader enables an application to load huge static data (static data items larger than 64K each) in Windows 3.0. Because the Windows 3.1 loader can load huge static data, the APPLOADER statement is not required.

Mixed-language programs built with C/C++ version 7.0 and FORTRAN version 5.1 must include an additional library, OLDNAMES.LIB, that is not required when the application is built with Microsoft C version 6.0. This requirement is a frequent cause of unresolved external errors, especially in projects that linked successfully when built with C 6.0. Under normal circumstances, an unresolved external error sets an error bit in the executable file, which prevents the Windows loader from attempting to load the incomplete executable file.

The following sample project demonstrates this problem. Note that the code calls the SUB2 subroutine but does not include any code with which to resolve the call. LINK version 5.3 does not generate any error; LINK version 5.15 correctly generates the following error message:

   error L2029: 'SUB2' : unresolved external

TEST.FOR

C Compile options required: fl /c /MW test.for

C Link command line:        link /NOD test,,, llibfew, test.def

      program test
      call sub2
      end

TEST.DEF

NAME           TEST WINDOWAPI
APPLOADER      '__MSLANGLOAD'
EXETYPE        WINDOWS 3.0
STUB           'WINSTUB.EXE'
PROTMODE
CODE           PRELOAD MOVEABLE DISCARDABLE
DATA           PRELOAD MOVEABLE
HEAPSIZE       1024
STACKSIZE      8096


Additional reference words: 5.30
KBCategory: kbtool kberrmsg kbbuglist kbfixlist
KBSubcategory: LinkIss
Keywords : kb16bitonly LINKIss kbbuglist kberrmsg kbfixlist kbtool
Version : 5.30 | 5.31 | 5.30
Platform : MS-DOS OS/2 WINDOWS
Solution Type : kbfix


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.

Last reviewed: September 16, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.