DIGITAL Fortran 90User Manual for DIGITAL UNIX Systems

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:

The C preprocessor
cpp
, which is provided with the DIGITAL UNIX operating system. To run
cpp
before Fortran 90 source files are compiled, specify the
-cpp
option on the
f90
command line. With fixed source form files, you can alternatively name
a file using a file suffix of
.f
to run
cpp
.

Preprocessors provided with optional products, such as the KAP
performance preprocessor (see Section 5.1.1). Such preprocessors
usually need to be run to create the appropriate source file (or files)
before you type the
f90
command line.

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.

The DIGITAL Fortran 90 compiler provides the following primary functions:

Verifying the correctness of DIGITAL Fortran 90 source statements and
displaying any warnings or error messages.

Generating machine-level object language instructions from the
source statements. If the
-wsf
option was specified, the compiler generates code enabled for parallel
execution, based on HPF language constructs in the input source files.
If the DIGITAL Parallel Software Environment is installed, the generated parallel HPF
program can execute on multiple processors.

Grouping the instructions to generate an object file that can be
processed by the linker.

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

The object file name. This is taken from the name
specified in the first PROGRAM, SUBROUTINE, FUNCTION, MODULE, or BLOCK
DATA statement in the source program. If a program unit does not have
any of these statements, the source file name is used, appended with
$MAIN (or $DATA for block data subprograms).

A list of global symbols declared in the object file.
The linker uses this information when it binds two or more program
units together and must resolve references to the same names in the
program units. Such global symbols include entry points and common
block names.

A symbol table (if specifically requested by the
-g
,
-g2
, or
-g3
options on the
f90
command line).
A symbol table lists the names of all external and internal variables
within an object file, with definitions of their locations. The table
is of primary use in program debugging.

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

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.

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:

Adding information for virtual memory allocation in the executable
program

Resolving symbol references among object files

Assigning values to relocatable global symbols

Performing relocation

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

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:

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
.

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.

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.

--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
-lstring 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:

The
-v
option displays the compilation and link passes with their arguments
and files, including the libraries passed to
ld
.

The file
test.f
is passed to the DIGITAL Fortran 90 compiler for compilation. The resulting
object file is passed to the linker.

The object file
calc.o
is passed directly to the linker. The linker links both object files
into an executable program.

The
-lmnd
option specifies that the object library
libmnd
should be searched for unresolved global references. Note that
-lmnd
is placed after the file names and other options.