The kfort
command invokes a driver program
that automatically calls KAP, the Fortran compiler, and the linker.
kfort
Because kfort
calls KAP and the Fortran compiler,
you can substitute the kfort
command for the Fortran
command. For example, to use kfort
to compile
myprog.f
with the default KAP qualifier settings,
use the command:
kfort myprog.f
The kfort
command uses the KAP preprocessor on
myprog.f
, compiles the result with the Fortran
compiler, links the object code into an executable image, and
produces the following files in the current directory:
myprog_cmp.f
- The optimized source file
myprog.out
- The annotated source file
showing default KAP qualifier settings
myprog.obj
- The object file
myprog.exe
- An executable file
To cause KAP to generate an executable file with a name you
specify, use the /executable
qualifier as follows:
kfort /executable=my_prog
my_prog.exe
results.
kfort
inserts /executable
in front of
the first file name it sees. For example, the following command
line produces one executable named file_1.exe
:
kfort /fkapargs=(/conc/ur=1) file_1.f file_2.f file_3.f
To see a list of the KAP qualifiers and Fortran compiler
qualifiers passed by kfort
, use the
/verbose
qualifier as follows:
kfort /fkapargs=(/verbose) myprog.f
An example of the output is as follows:
kapf /cmp=myprog_cmp.f myprog.f /natural KAP/OpenVMS_F90 V3.2 k310801 1999031 01-Mar-1999 13:16:07 0 errors in file myprog.f Issuing the compiler command: for/fast/optimize=(tune=host,level=5) myprog_cmp.f issuing link command: link /EXECUTABLE=myprog.exe myprog_cmp.obj
kfort
The /fkapargs
qualifier specifies one or more
KAP command qualifiers to the preprocessor. For example,
to use kfort
to optimize and compile the file
myprog.f
using KAP qualifiers for general
optimization, use the command:
kfort /fkapargs=(/optimize=5/roundoff=3/scalaropt=3/list=myprog_annotated.out) - myprog.f
The following files result:
myprog_cmp.f
- The optimized source file
myprog_annotated.out
- The annotated
source file renamed by the /list
qualifier
myprog.obj
- The object file
myprog.exe
- The executable file
For descriptions of all KAP command qualifiers, see Chapter 5.
kfort
Any command-line qualifier that is valid for the Fortran compiler
or the linker is valid for the kfort
command. You
can specify compiler qualifiers and KAP qualifiers on the same
line, as follows:
kfort /fkapargs=(/optimize=5/roundoff=3/scalaropt=3)/nowarn myprog.f
The kfort
command specifies the Fortran compiler
qualifiers /optimize=(tune=host,level=5)
,
/natural
, and /fast
by default. To override
any of the individual compiler qualifiers encompassed by
/fast
, specify them on the kfort
command
line. For example, the following command sets the compiler
qualifier /math_library=accurate
and overrides the
default /math_library=fast
set by /fast
:
kfort /math_library=accurate myprog.f
For information about the /fast
compiler qualifier,
see the Compaq Fortran User Manual for OpenVMS Alpha
Systems.
The /optimize=(tune=host,level=5)
qualifier causes
the compiler to optimize to the host architecture. For example, if
you want to optimize for the ev5
architecture but are
compiling on an ev4
system, you should override the
default setting of the /tune
qualifier, as follows:
kfort /optimize=(tune=ev4,level=4) myprog.f
The kfort
command specifies the linker qualifiers
/lpthread
and /non_shared
by
default. The /non_shared
qualifier causes the
image to be linked with archive libraries instead of with shared
libraries, often resulting in faster execution at run time.
To override the /non_shared
default, specify
/call_shared
on the command line, for example:
kfort /call_shared myprog.f
The kfort
driver accepts either Fortran or Fortran 77
source input. The exception is the Fortran compiler rejects comment
lines beginning with C
as syntax errors. Like the
fort
command, the kfort
command assumes
by default that source files with an extension of .f90
are free format, and source files with an extension of
.f
, .for
, or .FOR
are
fixed format. You can override these defaults by using a
format-related qualifier with either the KAP preprocessor or with
the Fortran compiler. The format-related compiler qualifiers are
/free
and /fixed
. The corresponding KAP
preprocessor qualifiers are /freeformat
and
/nofreeformat
. Table 2-1
lists combinations of qualifiers and file extensions and the
resulting assumption KAP makes about the format of the source file.
Qualifiers |
Source File Extension | ||
---|---|---|---|
KAP | F90 | .f90 | .f,.for,.FOR |
default | default | free | fixed |
/freeformat | default | free | free |
/nofreeformat | default | fixed | fixed |
default | /free | free | free |
default | /fixed | fixed | fixed |
/freeformat | /fixed | KAP issues error message | |
/nofreeformat | /free | KAP issues error message |
For more information about the /[no]freeformat
qualifier, see Section 5.3.7. For more
information about the /free
and /fixed
qualifiers, see the Compaq Fortran User Manual for OpenVMS Alpha
Systems.
Copyright © Digital Equipment Corporation. 1999. All Rights Reserved.