HP Fortran Programmer Guide HP-UX 11i v1, HP-UX 11i v2, and HP-UX 11i v3 (B3908-90032,December 2012)
procedures that are defined in these files. This option
enables optimizations that assume that there are no
unseen accesses to the globals. This option can be used
at optimization level 4.
The default is +Onowhole_program_mode
.
Filenames
The f90command accepts files with any of the filename extensions listed in Table 2-12. The table
also describes the meaning each name has for the f90command. Files with names other than
those listed in the table are passed to the linker.
Table 21 Filenames recognized by f90
MeaningFilenames
Free-form Fortran source code; processed by the compiler.file.f90
Fixed-form Fortran source code; processed by the compiler.file.f
Fixed-form Fortran source code; first processed by the C preprocessor (cpp), then
by the compiler.
file.F
Free-form output from the C preprocessor (if the source file ends in .f90); processed
by the compiler.
file.i90
Fixed-form output from the C preprocessor (if the source file ends in .For .f);
processed by the compiler.
file.i
Object code; passed to the linker (ld).file.o
Assembly language code; passed to the assembler (as).file.s
NOTE: The compiler generates a.modfile for each file that defines a Fortran module. It also reads
the .modfiles when compiling source files that use modules. Do not specify .modfiles on the
command line. If you do, the compiler will pass them to the linker, which will try (and fail) to link
them into the executable. For more information about .modfiles, see “Compiling programs with
modules” on page 85.
Linking HP Fortran programs
This section discusses how to link object files and covers the following topics:
• The advantages of using the f90 command for linking as well as for compiling
• How to link libraries, including shared libraries
• How to establish the search rules used by the linker when it looks for libraries
For more information about the linker, refer to Programming on HP-UXand to the ld(1) man page.
Linking with f90 vs. ld
By default, the f90command both compiles and links, producing an executable program. You can
modify this behavior with the -coption, which causes f90to compile only, writing the object files
(if the compilation is successful) in the current working directory. If the command line contains
object files only, f90passes them to the linker (ld) for linking into the executable program. In other
words, you can use the f90command to compile and link in one command line or in separate
command lines. You do not need to invoke the ld command separately.
In fact, we recommend that you use the f90command whenever you link HP Fortran object files
and that you use the same command line for linking as for compiling.
48 Compiling and linking