Sun Studio 12: Fortran User's Guide

3.4.56 –Mpath

Specify MODULE directory, archive, or file.

Look in path for Fortran 95 modules referenced in the current compilation. This path is searched in addition to the current directory.

path can specify a directory, .a archive file of precompiled module files, or a .mod precompiled module file. The compiler determines the type of the file by examining its contents.

An archive .a file must be explicitly specified on a -M option flag to be searched for modules. The compiler will not search archive files by default.

Only .mod files with the same names as the MODULE names appearing on USE statements will be searched. For example, the statement USE ME causes the compiler to look only for the module file me.mod

When searching for modules, the compiler gives higher priority to the directory where the module files are being written. This is controlled by the -moddir compiler option, or the MODDIR environment variable. When neither are specified, the default write-directory is the current directory. When both are specified, the write-directory is the path specified by the -moddir flag.

This means that if only the -M flag appears, the current directory will be searched for modules first before any object listed on the -M flag. To emulate the behavior of previous releases, use:

-moddir=empty-dir -Mdir -M

where empty-dir is the path to an empty directory.

A space between the -M and the path is allowed. For example, -M /home/siri/PK15/Modules

On Solaris, if the path identifies a regular file that is not an archive or a module file, the compiler passes the option to the linker, ld, which will treat it as a linker mapfile. This feature is provided as a convenience similar to the C and C++ compilers.

See 4.9 Module Files for more information about modules in Fortran 95.