Microsoft KB Archive/133103

= FORTRAN PowerStation 32 README.TXT: Debugger and Building =

PSS ID Number: 133103

Article Last Modified on 11/2/1999

-

The information in this article applies to:


 * Microsoft Fortran Powerstation 32 for Windows NT 1.0

-



This article was previously published under Q133103



SUMMARY
The following information is from the Microsoft FORTRAN PowerStation 32 README.TXT file located in the \FPSNT\README directory.

This file has four parts: ' Part    Contents 1      Installation 2      Debugging 3      Building and Running Programs 4      Miscellaneous



MORE INFORMATION
=======================< Part 2: The Debugger >=========================

Subscript Checking on Arrays of Dimension 1 --- In prior versions of Microsoft FORTRAN, debug information generated by the /4Yb compiler option or the $DEBUG metacommand did not perform array subscript range checking on arrays dimensioned with a dimension of 1. This functionality has changed. Any attempt to access beyond the declared dimension of any array will cause a run-time error if debugging information is enabled. To disable subscript range checking for arrays passed to subroutines, declare the dimension in the subroutine to be "*" and not "1".

Viewing Allocatable Arrays

One special case of viewing variables is the Allocatable Array. Since these arrays can be of any size, the watch window and locals window do not allow you to expand these arrays by double-clicking on them. If you need to view elements of the array, you can enter the individual element you want to view into the watch window. For example, to view the 10th element of an INTEGER array A, you would type A(10). To view the entire array, you can use the memory window. Use the Watch or QuickWatch window to determine the address of the array, then open the memory window and type it into the address field. Use the Options/Memory dialog to change the format of the memory window to the required data type.

MULTI Type for Symbols -- Variables that you define to be CHARACTERS, COMPLEX, or RECORD will appear in the local symbol table as the type MULTI. This is because the compiler treats these variable types as multiple-byte objects.

Displaying Structure Elements in the Watch Window - You cannot view a single element of an array that is a member of a structure. Instead, you must enter the name of the array itself. To see the elements, you must expand the array. If you have an array of structures, you can specify one structure using the FORTRAN syntax.

For example

struc(2).element

is legal, while

struc.element(2)

is not allowed.

The easiest way to get the information into the watch window for use in expression evaluation is to expand the structure in the watch window, and then copy and paste the needed information into the watch window.

Run-time Errors in the Debugger --- If a run-time error occurs while a program is running, the program stops executing and all of its windows are closed. When this happens to an application that is running in the debugger, the window in which the application was running is closed, preventing you from reading the run-time error message and the $DEBUG traceback (if present).

To keep the window from closing, set a breakpoint at "_exit". This stops execution after the run-time error has been generated but before the window is closed.

Viewing Variables in a Common Block Belonging to a DLL -- To view the contents of a variable that is in a common block belonging to a DLL, you must enter the context of the DLL as part of the watch expression. For example, to specify a watch on variable X in SAMPLE.DLL, you would enter the following watch expression:

{,,sample.dll}X

For more information on contexts, see Help.

Using the "m" Watch Variable Format Descriptors --- The memory watch variable formats (ma, m[b], mw, and md) do not work with FORTRAN expressions or variables. However, they do work with C language expressions and variables, which can be used to monitor memory locations even if the program being debugged is entirely FORTRAN.

=
==< Part 3: Building and Running Programs >================

Limit to Number of Threads for I/O -- A user may have up to 32 threads perform FORTRAN I/O throughout the lifetime of a program. The 33rd thread to do I/O will cause a run-time error. Even if a thread has been killed, it counts toward the 32 thread maximum if it ever did I/O. There is no limit on the number of threads that do no I/O.

Using DLL Libraries when Linking with /ML or /MT

When using DLL libraries, the main executable should be linked with the /MD driver switch. Problems can occur when linking an executable with /ML or /MT and using a DLL, since there would be two copies of the run-time libraries present in the executable. The DLL version would be present because DLLs are always built with /MD, and the static version would be present because of the /ML or /MT switch. In this case, file unit numbers do not refer to the same files from within the main program and from within a DLL; this may also cause newlines to be emitted in unexpected places. These problems are avoided when linking with /MD because only one copy of the run-time library is in use by both the executable and the DLL. The only exception to the rule that /MD should be used when linking with DLLs is when building a QuickWin application because /MD is not permitted (see the note in QUICKWIN.TXT).

Chapter 17, "Building Programs and Libraries", states that you can use /ML or /MT with the /LD option. This is incorrect. The /LD switch implies /MD, but the driver will no longer allow a /M option with /LD.

Writing INTERFACE TO Statements for STDCALL Routines

When writing INTERFACE TO statements for procedures that use the STDCALL calling convention, an ALIAS must be used to specify the '@num' where the num indicates the number of bytes pushed on the stack during the call. If the alias string ends with an at sign (@) (with no number), the compiler will determine the stack size for you based on the size of the arguments in the INTERFACE TO statement. (The correct alias name with the stack size postpended will be emitted in the object file.)

Using MATHERRQQ --- Because of performance constraints, some intrinsic functions may not work with MATHERRQQ when you compile with optimizations for time (the /Ox switch) enabled. MATHERRQQ does not work when linking with the DLL versions of the FORTRAN and C run-time libraries. MATHERRQQ is also not called for math error handling when the FORTRAN run-time library is a DLL. To use the run-time libraries in a DLL, you must compile the main program with the /MD switch. Finally, the default error handler for errors from intrinsic functions cannot be replaced by MATHERRQQ in a DLL or when a program is compiled to use the FORTRAN run-time library in a DLL.

Additional query words: 1.00

Keywords: KB133103

Technology: kbAudDeveloper kbFORTRANPower32100NT kbFortranSearch kbZNotKeyword2

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© 2004 Microsoft Corporation. All rights reserved.