DIGITAL Fortran 90
User Manual for
DIGITAL UNIX Systems


Previous Contents Index

1.4.2 cpp and Other Preprocessors

When you use a preprocessor for DIGITAL Fortran 90 source files, the output files the preprocessor creates are used as input source files by the DIGITAL Fortran 90 compiler. Preprocessors include:

When the f90 command driver passes object and other files to cc , cc applies the cpp preprocessor to files that it recognizes, such as any file with a .c suffix.

1.4.3 DIGITAL Fortran 90 Compiler

The DIGITAL Fortran 90 compiler provides the following primary functions:

The object file created by the compiler contains information used by the linker, including the following:

The file name of the DIGITAL Fortran 90 compiler is decfort90 , which may appear in certain messages.

1.4.4 Other Compilers

You can compile and link multilanguage programs using a single f90 command.

The f90 command recognizes C or Assembler program files by their file suffix characters and passes them to the cc driver and compiler for compilation. Before compilation, cc applies the cpp preprocessor to files that it recognizes, such as any file with a .c suffix, and passes appropriate files to other compilers or the assembler.

Certain options passed to cc are passed by cc to the ld linker.

1.4.5 Linker (ld)

When you enter an f90 command, the ld linker is invoked automatically unless a compilation error occurs or you specify the -c option on the command line. The linker produces an executable program image with a default name of a.out .

The ld linker provides such primary functions as:

For more information, see ld(1) and the DIGITAL UNIX Programmer's Guide.

1.5 Program Development Stages and Tools

This manual primarily addresses the program development activities associated with implementation and testing phases. For information about topics usually considered during application design, specification, and maintenance, see your operating system documentation, appropriate reference pages, or appropriate commercially published documentation.

Table 1-1 lists and describes some of the software tools you can use when implementing and testing a program:

Table 1-1 Main Tools for Program Development and Testing
Task or Activity Tool and Description
Manage source files Use rcs or sccs to manage source files. For more information, see the DIGITAL UNIX Using Programming Support Tools or the appropriate reference page.
Create and modify source files Use a text editor, such as vi or emacs . For more information, see your operating system documentation.
Analyze source code Use searching commands such as grep and diff . For more information, see the DIGITAL UNIX Using Programming Support Tools and the appropriate reference page.
Build program (compile and link) You can use the f90 command to create small programs, perhaps using shell scripts, or use the make command to build your application in an automated fashion using a makefile. For more information on f90 , see Chapter 2 in this manual. For more information on make , see the make(1) reference page and the DIGITAL UNIX Using Programming Support Tools.
Debug and Test program Use Ladebug (or dbx) to debug your program or run it for general testing. For more information on debugging, see Chapter 4 in this manual.
Analyze performance To perform profiling of code, use the prof and pixie programs. The f90 command option needed to use prof is -p (same as -p1 ).

To perform call graph profiling, use the gprof tool. The f90 command option needed to use gprof is -pg .

Related profiling tools include the use of feedback files and cord .

For more information on profiling Fortran 90 code, see Chapter 5.

For more information on profiling parallel HPF applications with the pprof profiler, see the DIGITAL High Performance Fortran 90 HPF and PSE Manual.

Install program Use setld and related commands such as tar . For more information, see the DIGITAL UNIX Using Programming Support Tools.

To view information about an object file or an object library, use the following shell commands:

For more information on these commands, see the appropriate reference page or the DIGITAL UNIX Programmer's Guide.

To perform other program development functions at various stages of program development:

For More Information:


Chapter 2
Compiling and Linking DIGITAL Fortran 90 Programs

This chapter provides information on the following topics:

For detailed information on f90 command options, see Chapter 3.

2.1 The f90 Command: Files and Options

You should almost always use the f90 command to invoke both the DIGITAL Fortran 90 compiler and the ld linker.

To link one or more object files created by the DIGITAL Fortran 90 compiler, you should use the f90 command (instead of the ld command), because the f90 command automatically references the appropriate DIGITAL Fortran 90 Run-Time Libraries when it invokes ld .

When you create your source files using a text editor, use file name suffix conventions expected by the f90 command, as described in Section 2.1.1.

2.1.1 File Suffixes and Source Forms

When creating a source file, choose the file name suffix appropriate for the source form (fixed or free). The f90 command recognizes certain source file suffixes as Fortran 90 source files.

Table 2-1 shows the recognized Fortran 90 source file suffixes.

Table 2-1 File Suffixes Recognized as Fortran 90 Source Files
Suffix Description
.f90 Identifies Fortran 90 files in free source form passed to the DIGITAL Fortran 90 compiler.
.f , .for , .for Identifies Fortran files in fixed (or tab) source form passed to the DIGITAL Fortran 90 compiler but not preprocessed by cpp .
.f Identifies Fortran files in fixed (or tab) source form passed to the cpp preprocessor and then compiled by the DIGITAL Fortran 90 compiler.

Except for .f files, preprocessors are not automatically run before DIGITAL Fortran 90 compilation. To request that the cpp preprocessor be run before compilation, specify the -cpp option.

You can specify the source file form for all Fortran files on an f90 command line by using the -free option or -fixed option.

Table 2-2 shows other file name suffixes.

Table 2-2 Other File Name Suffixes
Suffix Description
Library and Object Files
.a Identifies archive object libraries passed to cc , which are in turn passed to ld . All routines in the specified object library are searched during linking to resolve external references.
.o Identifies object files passed to ld .
.so Identifies shared object libraries passed to cc , which are in turn passed to ld . All routines in the specified object library are searched during linking to resolve external references.
DIGITAL Fortran 90 Module Files
.mod Identifies Fortran 90 module files created by the DIGITAL Fortran 90 compiler. You do not create a .mod file directly and cannot specify a .mod file on the f90 command line (see Section 2.1.4).
Other Source Files
.c Identifies C language source files passed to the C compiler driver cc , which performs additional command line parsing before invoking cpp and the C language compiler.
.i , .i90 Identifies intermediate files passed from cpp to the DIGITAL Fortran 90 compiler. The .i or .i90 files are usually created by using the f90 options -p or -k (keep intermediate file) and -cpp (invoke cpp ).
.s Identifies assembler files passed to cc .

To specify libraries (in addition to those automatically searched by the f90 command), you can also use an f90 command option, such as the -lstring option.

Source file suffixes used by other DIGITAL languages include: Ada ( .ada ), C++ ( .cxx , .cc , .c ), COBOL ( .cob ), Pascal ( .p ), and PL/I ( .pli ).

For More Information:

On source forms and source coding guidelines that allow the same source file to be used with multiple source forms, see the DIGITAL Fortran Language Reference Manual.

2.1.2 Format of the f90 Command

The f90 command has the following general form:

f90 [--options [args]]... filename [filename]... [--options [args]]...

--options [args]

Indicates either special actions to be performed by the compiler or linker, or special properties of input or output files. For details about command line options, see Chapter 3.

If you specify the -l string option (which indicates libraries to be searched by the linker) or an object library file name, place it after the file names and after other options.

filename

Specifies the source files containing the program units to be compiled and other files to be used by the DIGITAL Fortran 90 compiler. The file name has a suffix that indicates the type of file used, such as .f90 or .f (see Section 2.1.1).

If you omit the suffix or it is not one of the preceding types recognized by the f90 command, the file is assumed to be an object file and is passed directly to the linker.

An example f90 command line follows:


% f90 -v test.f calc.o -lmnd

This command specifies the following:


Previous Next Contents Index