Fortran Module Names and ATTRIBUTES

Fortran module entities (data and procedures) have external names that differ from other external entities. Module names use the convention:

modulename_mp_entity_

modulename  is the name of the module and entity  is the name of the module procedure or module data contained within modulename. _mp_ is the separator between the module and entity names and is always lowercase.

For example:

MODULE mymod   INTEGER a CONTAINS   SUBROUTINE b (j)      INTEGER j   END SUBROUTINE END MODULE

This results in the following symbols being defined in the compiled .o file:

mymod_mp_a_
mymod_mp_b_

Compiler options can affect the naming of module data and procedures.

Note

ATTRIBUTES properties do not affect the module name.

The following table shows how each ATTRIBUTES property affects the subroutine in the previous example module.

Effect of ATTRIBUTES Options on Fortran Module Names

ATTRIBUTES Property Given to Routine 'b'

Procedure Name in .o file

None

mymod_mp_b_

C

mymod_mp_b

ALIAS

Overrides all others, name as given in the alias

VARYING

No effect on name

You can write code to call Fortran modules or access module data from other languages. As with other naming and calling conventions, the module name must match between the two languages. Generally, this means using the C convention in Fortran, and if defining a module in another language, using the ALIAS property to match the name within Fortran. For examples, see Using Modules in Fortran/C Mixed-Language Programming.