Running Fortran Applications

You can execute programs built with this version of Visual Fortran only on a computer running the Microsoft Windows 2000, Windows NT, Windows Me, or Windows 9x operating system. You can run the programs from the command console, Start ... Program ... group, Windows Explorer, and the Microsoft visual development environment.

Each program is treated as a protected user application with a private address space and environment variables. Because of this, your program cannot accidentally damage the address space of any other program running on the computer at the same time.

Environment variables defined for the current user are part of the environment that Windows sets up when you open the command console. You can change these variables and set others within the console session, but they are only valid during the current session.

If you run a program from the console, the operating system searches directories listed in the PATH user environment variable to find the executable file you have requested. You can also run your program by specifying the complete path of the .EXE file. If you are also using DLLs, they must be in the same directory as the .EXE file or in one specified in the path.

You can easily recover from most problems that may arise while executing your program.

If your program is multithreaded, Windows NT and Windows 2000 starts each thread on whichever processor is available at the time. On a computer with one processor, the threads all run in parallel, but not simultaneously; the single processor switches among them. On a computer with more than one processor, the threads can run simultaneously.

If you specified the /fpscomp:filesfromcmd option (Compatibility category in Project Settings, Fortran tab), the command line that executes the program can also include additional filenames to satisfy OPEN statements in your program in which the filename field (FILE specifier) has been left blank. The first filename on the command line is used for the first such OPEN statement executed, the second filename for the second OPEN statement, and so on. In the visual development environment, you can provide these filenames in the Project menu Settings item, Debug tab, in the Program Arguments text box.

Each filename on the command line (or in a visual development environment dialog box) must be separated from the names around it by one or more spaces or tab characters. You can enclose each name in double quotation marks ("filename"), but this is not required unless the argument contains spaces or tabs. A null argument consists of an empty set of double quotation marks with no filename enclosed ("").

The following example runs the program MYPROG.EXE from the console:

  MYPROG "" OUTPUT.DAT

Because the first filename argument is null, the first OPEN statement with a blank filename field produces the following message:

  File name missing or blank - please enter file name<R>
  UNIT number  ?

The number is the unit number specified in the OPEN statement. The filename OUTPUT.DAT is used for the second such OPEN statement executed. If additional OPEN statements with blank filename fields are executed, you will be prompted for more filenames. Programs built with the QuickWin library prompt for a file to open by presenting a dialog box in which you can browse for the file or type in the name of a new file to be created.

Instead of using the /fpscomp:filesfromcmd option, you can:

If you use the visual development environment debugger and need to specify a working directory that differs from the directory where the executable program resides, specify the directory in the Project menu Settings item, Debug tab, in the Working Directory text box.

Run-time error messages are displayed in the console or in a message box depending upon the project type of the application you build (see Run-Time Message Display and Format). If you need to capture these messages, you can redirect stderr to a file. For example, to redirect run-time error messages from a program called BUGGY.EXE to a file called BUGLIST.TXT, you would use the following syntax:

  BUGGY.EXE > BUGLIST.TXT

The redirection portion of the syntax must appear last on the command line. You can append the output to an existing file by using two greater-than signs (>>) instead of one. If the file does not exist, one is created. For more information about command-line redirection, see Redirecting Command-Line Output to Files.

To run (deploy) your application on another Windows system, use the VFRUN tool to install the necessary run-time DLLs and related files. The VFRUN tool provides the run-time redistributable files for Visual Fortran applications, in the form of a self-installing kit. You can download the run-time redistributable files VFRUN kit from the Visual Fortran Web page (click Downloads area). VFRUN and the deployment of Visual Fortran applications is further described in the Compaq Visual Fortran Installing and Getting Started guide.

For more information: