SUBMODULE (Fortran 2008)
Purpose
The SUBMODULE statement is the first statement of a submodule program unit.
Syntax
parent_identifier
- submodule_name
- Name of the submodule.
- ancestor_module_name
- Name of a nonintrinsic module.
- parent_submodule_name
- Name of a descendant submodule of the ancestor_module.
Rules
A submodule name cannot be accessed by use association; that is, it cannot be referred to by the USE statement.
A submodule cannot have the same name as any other program unit, external procedure, common block, or entity with a binding label in the program. In addition, the submodule name cannot be the same as any local name in the submodule. The name of a submodule can be the same as the name of another submodule if they do not have the same ancestor module.
If the END statement that completes the submodule specifies a submodule name, the name must be the same as the one that the SUBMODULE statement specifies.
Examples
MODULE mod
...
END MODULE
SUBMODULE (mod) mod1 ! parent_submodule_name is not specified
...
END SUBMODULE
SUBMODULE (mod) mod2 ! parent_submodule_name is not specified
...
END SUBMODULE
SUBMODULE (mod:mod1) mod3 ! parent_submodule_name is specified
...
END SUBMODULE