Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

Modules and Module Procedures

A module program unit contains specifications and definitions that can be made accessible to other program units. There are two types of modules, intrinsic and nonintrinsic. Intrinsic modules are included in the Fortran library; nonintrinsic modules are user-defined.

For the module to be accessible, the other program units must reference its name in a USE statement, and the module entities must be public. This module reference lets the program unit access the public definitions, specifications, and procedures in the module. Entities in a module are public by default, unless the USE statement specifies otherwise or the PRIVATE attribute is specified for the module entities.

A module reference causes use association between the using program unit and the entities in the module.

A submodule extends a module or another submodule. It provides additional structuring facilities for modules. Data objects and procedure pointers declared in a module implicitly have the SAVE attribute.

For more information on module program units, see MODULE. For more information about submodule program units, see SUBMODULE.

A module procedure is a procedure declared and defined in a module, between its CONTAINS and END statements. For more information, see MODULE PROCEDURE.