2.21. -p module_site

The -p module_site option allows you to specify a file or directory that contains modules.

The module_site specifies the name of a binary file or directory to search for modules. The module_site specified can be an archive file, build file (bld file), or binary file.

When searching files, the compiler searches files suffixed with .o (file.o) or library files suffixed with .a (lib.a) containing one or more modules. When searching a directory, the compiler searches files in the named directory that are suffixed with .o or .a, or if the -em option is specified, the compiler searches .mod files. After searching the directory named in module_site, the compiler searches for modules in the current directory.

File name substitution (such as *.o) is not allowed. If the path name begins with a slash (/), the name is assumed to be an absolute path name. Otherwise, it is assumed to be a path name relative to the working directory. If you need to specify multiple binary files, library files, or directories, you must specify a -p option for each module_site. There is no limit on the number of -p options that you can specify. The compiler searches the binary files, library files, and directories in the order specified.

A module called FTN_IEEE_DEFINITIONS is provided as part of the Cray Fortran Compiler Programming Environment. The system file that contains this module is searched last. To reference this module, specify USE FTN_IEEE_DEFINITIONS.

Example 1: Consider the following command line:

% ftn -p steve.o -p mike.o joe.f

Assume that steve.o contains a module called Rock and mike.o contains a module called Stone. A reference to use Rock in joe.f causes the compiler to use Rock from steve.o. A reference to Stone in joe.f causes the compiler to use Stone from mike.o.

Example 2: The following example specifies binary file murphy.o and library file molly.a:

% ftn -p murphy.o -p molly.a prog.f

Example 3: In this example, assume that the following directory structure exists in your home directory:

            programs
           /    |    \
      tests   one.f   two.f
        |
     use_it.f

The following module is in file programs/one.f, and the compiled version of it is in programs/one.o:

MODULE one
INTEGER i
END MODULE

The next module is in file programs/two.f, and the compiled version of it is in programs/two.o:

MODULE two
INTEGER j
END MODULE

The following program is in file programs/tests/use_it.f:

PROGRAM demo
USE one
USE two
. . .
END PROGRAM

To compile use_it.f, enter the following command from your home directory, which contains the subdirectory programs:

% ftn -p programs programs/tests/use_it.f

Example 4: In the next set of program units, a module is contained within the first program unit and accessed by more than one program unit. The first file, progone.f, contains the following code:

MODULE split
INTEGER k
REAL a
END MODULE

PROGRAM demopr
USE split
INTEGER j
j = 3
k = 1
a = 2.0
CALL suba(j)
PRINT *, 'j=', j
PRINT *, 'k=', k
PRINT *, 'a=', a
END

The second file, progtwo.f, contains the following code:

SUBROUTINE suba(l)
USE split
INTEGER l
l = 4
k = 5
CALL subb(l)
RETURN
END

SUBROUTINE subb(m)
USE split
INTEGER m
m = 6
a = 7.0
RETURN
END

Use the following command line to compile the two files with one ftn command and a relative pathname:

% ftn -p progone.o progone.f progtwo.f

When the -e m option is in effect, you can use the -p module_site option to specify one or more directories that contain module files rather than specifying every individual module file name.