Microsoft KB Archive/90312

= FORTRAN FastTips Questions & Answers (Complete) =

ID: Q90312

SUMMARY
Microsoft(R) Product Support Services Application Note (Text File) HF0621: FORTRAN Questions & Answers Revision Date: 9/93 No Disk Included The following information applies to Microsoft FORTRAN 5.1


 * INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY   |
 * ACCOMPANY THIS DOCUMENT (collectively referred to as an           |
 * Application Note) IS PROVIDED &quot;AS IS&quot; WITHOUT WARRANTY OF ANY     |
 * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO   |
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A    |
 * PARTICULAR PURPOSE. The user assumes the entire risk as to the    |
 * accuracy and the use of this Application Note. This Application   |
 * Note may be copied and distributed subject to the following       |
 * conditions: 1) All text must be copied without modification and   |
 * all pages must be included; 2) If software is included, all files |
 * on the disk(s) must be copied without modification [the MS-DOS(R) |
 * utility DISKCOPY is appropriate for this purpose]; 3) All         |
 * components of this Application Note must be distributed together; |
 * and 4) This Application Note may not be distributed for profit.   |
 * Copyright 1992 Microsoft Corporation. All Rights Reserved.        |
 * Microsoft and MS-DOS are registered trademarks and Windows        |
 * is a trademark of Microsoft Corporation.                          |
 * is a trademark of Microsoft Corporation.                          |

1. Q. I am unable to link a program; I always receive the error message &quot;Invalid Object Module.&quot; What is causing this problem?

A. Check that you are using the correct version of the linker. For Microsoft FORTRAN version 5.1, you should have LINK.EXE version 5.15; for FORTRAN version 5.0, you should have LINK.EXE version 5.03. It is common to find an old version of LINK.EXE somewhere in your path. Check your DOS directory first. If you find an      outdated LINK.EXE file in your DOS directory, rename it to       something other than LINK.EXE or delete it.

2. Q. When I compile and link from within Programmer's      WorkBench, the error message &quot;Cannot find file CORE.ASM&quot; is       displayed. When I link under Microsoft MS-DOS, I receive many L2029 unresolved external errors. What causes these errors?

A. These errors can be caused by having a C-compatible FORTRAN run-time library. If you select C compatibility in the Microsoft FORTRAN Setup program, a substantial portion of the FORTRAN library is removed, which means that you must link with both the Microsoft C and the FORTRAN run-time libraries at all times. If you are not doing mixed-language programming with the Microsoft C Compiler, run the Setup program again, and choose the Load Or Build Additional Libraries option. Supply the necessary information and make sure that you choose No in      response to the prompt &quot;Install for compatibility with C?&quot;

3. Q. I have problems with Programmer's WorkBench loading and compiling incorrectly. How can I correct these problems?

A. Make sure that you start the application with the command PWB and not PWBED. PWBED is the editor portion of the application only. Also, verify that your TMP and INIT environment variables are correctly set by typing &quot;SET&quot; (without the quotation marks) at the MS-DOS command line and then pressing ENTER. If the variables are set correctly, try to start Programmer's      WorkBench again. If problems persist, verify that you have copied the file TOOLS.PRE to TOOLS.INI in the FORTRAN\INIT directory.

4. Q. When I compile and link my FORTRAN source code using the Programmer's WorkBench application, the error messages &quot;LINK: warning L4051 : LLIBF7R.LIB: cannot find library&quot; and &quot;LINK warning L4021: no stack segment&quot; are displayed. How can I avoid these error messages?

A. These error messages may be caused by failing to copy the file TOOLS.PRE to TOOLS.INI in the FORTRAN\INIT directory. Also, verify that the INIT environment variable is set to the directory containing the TOOLS.INI file. If you do not have a      coprocessor, make sure that you select the correct floating- point option in Programmer's WorkBench. From the Options menu in Programmer's WorkBench, choose FORTRAN Compiler Options. At      the bottom of the FORTRAN Compiler Options dialog box, select the Set Debug Options button or the Set Release Options button to bring up the next dialog box. In this dialog box, change the selected floating-point option to Inline Emulation.

5. Q. I am receiving one of the following link error messages: &quot;L2041 Stack Plus Data exceeds 64K,&quot; &quot;L1070 Segment exceeds 64K,&quot; or &quot;L2002 Fixup Overflow.&quot; How can I avoid these error messages?

A. You can prevent these errors by compiling with the /Gt option, which is documented in the &quot;Microsoft FORTRAN Reference.&quot; If      the errors still occur after you compile all your source code with the /Gt option, try recompiling with the /Gt3 option.

6. Q. My program is behaving erratically and I receive a run- time error when I run my program. I want to determine the line number in the source code that is causing the error. How can I      do this?

A. Try compiling your program with the /4Yb debugging option. This option provides a line number of the source code that is      causing the error, along with the run-time error message. The option also installs routines that check for array subscripts that go out of range and for other errors. The /4Yb debugging option is documented in the &quot;Microsoft FORTRAN Reference.&quot;

7. Q. When I try to build a Windows-based QuickWin application, I receive the linker error message &quot;LINK: warning L4021: no      stack segment.&quot; Or, when I try to run a QuickWin application, the error message &quot;The specified application is not a Windows or MS-DOS application&quot; is displayed. How can I correct these problems?

A. These two problems are caused by not including the FL.DEF module-definitions file in the definition file field on the link command line or in the Programmer's WorkBench program list. FL.DEF is located in the FORTRAN\BINB directory.

8. Q. I get the compiler error &quot;F1901 program too large for memory during compile.&quot; How can I correct this problem?

A. Try using the high-capacity compiler. To use the high-capacity compiler with FORTRAN 5.1, add the compiler option /B1 F1L.EXE on your FL command line. From the Options menu in Programmer's      WorkBench, choose FORTRAN Compiler Options. On the Additional Options line, add /B1 F1L.EXE. Using FORTRAN 5.0, copy the file F1L.EXE from the high-capacity compiler disk shipped with FORTRAN 5.0 into your BIN directory. Then use the compiler option /B1 F1L.EXE.

9. Q. When I create a Windows-based FORTRAN application from Programmer's WorkBench, the error message &quot;Windows library not installed, Assume explicit library name?&quot; is displayed. How can I correct this problem?

A. You may not have installed your FORTRAN compiler for both MS-DOS and Windows targeting. In the FORTRAN 5.1 Setup program, you are prompted to select the target operating system. To      install FORTRAN for Windows targeting, you must move the arrow key down to the DOS And Windows selection and press the SPACEBAR. This places an asterisk next to the selection. If you do not press the SPACEBAR and you do press the ENTER key, Windows targeting is not installed. Reinstall FORTRAN if      necessary, and make sure that you press the SPACEBAR on all multiple-selection screens.

10. Q. My application compiled and linked without any errors. When I      try to run my application under MS-DOS, either the error message &quot;Cannot execute &quot; (where  is      the name of my executable file) is displayed, or my machine hangs. My application is large and declares a large amount of      data. How can I correct this problem?

A. Make sure that the program is not larger than the amount of      available conventional MS-DOS memory. Conventional MS-DOS memory cannot exceed 640K; extended memory is not available for standard MS-DOS-based applications. The size of the executable file provides a rough estimate of the application size.

For FORTRAN version 5.1, use the EXEHDR utility to determine the amount of memory needed to run the program. Type &quot;exehdr program.exe&quot; (without the quotation marks) and press ENTER. If      you have FORTRAN 5.0, use the EXEMOD utility, rather than the EXEHDR utility. To determine the amount of available conventional MS-DOS memory, type &quot;chkdsk&quot; (without the      quotation marks) and press ENTER. The last entry on the screen should read &quot; bytes free,&quot; where  is the amount of      available conventional memory. Because Microsoft FORTRAN does not provide an MS-DOS extender, to access extended memory you must compile and link your code to run under a protected mode operating system. With FORTRAN version 5.0, you can compile and link to run under OS/2. With FORTRAN version 5.1, you can compile and link to run under either Windows or OS/2. Additional reference words: 1.00 5.00 5.10 ivrfax fast tips ahf10 ahf50 ahf51 KBCategory: kbprg kbother kbappnote KBSubcategory: FORTLngIss FLIss

Last Reviewed: July 17, 1995