HP Fortran Programmer's Guide (B3908-90031; September 2011)

Compiling and linking
Special-purpose compilations
Chapter 2 89
Managing .mod files
By default, the compiler writes .mod files to the current working directory and looks there when it has to
read them. The +moddir=directory and -I directory options enable you to specify different
directories. The +moddir option causes the compiler to write .mod files in directory, and the -I option
causes the compiler to search directory for .mod files to read. (The space character between -I and
directory is optional.)
Using the example of the do_stats program, the following command line compiles (without linking)
data.f90 and writes a .mod file to the subdirectory mod_files:
$ f90 -c +moddir=mod_files data.f90
The command line:
$ f90 -c +moddir=mod_files -I mod_files code.f90
uses both the +moddir and -I options, as follows:
The +moddir option causes f90 to write the .mod file for code.f90 in the subdirectory mod_files.
• The -I option causes f90 to look in the same subdirectory for the .mod file to read when compiling
code.f90.
The command line:
$ f90 -odo_stats -I mod_files main.f90 code.o data.o
causes f90 to compile main.f90, look for the .mod file in the subdirectory mod_files, and link all of the
object files into an executable program named do_stats.
Compiling for different PA-RISC machines
When you compile an HP Fortran 90 program, the object code that the compiler generates by default is
based on the PA-RISC model of the machine that is running the compiler. If your program will execute on a
different PA-RISC model machine, the code may run less efficiently or (in the case of PA2.0 code that
attempts to run on a PA1.1 machine) may not run at all.
Also, some libraries (for example, the math library) are available in different PA-RISC versions. By default,
the compiler selects the version that is based on the PA-RISC model of the compiling machine. If your
program will execute on a different model machine, it may not be linked with the appropriate libraries.
Compiling with the +DAmodel option ensures that the compiler generates code that is based on the
architecture specified by model and that the linker selects libraries that are compatible with model. model
must be one of the following:
A PA-RISC version number—1.1, 2.0, or 2.0W. Use +DA2.0W to compile in 64-bit mode; see
“Compiling in 64-bit mode” on page 95.
A model number—for example, 750 or 870.