Microsoft KB Archive/87545

{|
 * width="100%"|

FIX: No L2029 Error, &quot;APPLOADER&quot; in Module-Definition File

 * }

Q87545

-

The information in this article applies to:


 * Microsoft LINK for MS-DOS, 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 query words: 5.30

Keywords : kberrmsg kb16bitonly

Issue type :

Technology : kbAudDeveloper kbZNotKeyword3 kbLINKSearch kbLINK530DOS kbLINK531OS2