Separate module procedures (Fortran 2008)
A separate module procedure is a module procedure that is defined by a separate module subprogram, or by a function or subroutine subprogram whose initial statement contains the MODULE prefix specifier. A separate module procedure defines a module procedure interface body.
- A separate module procedure must be previously declared by a module procedure interface body in the containing program unit, in the ancestor module, or in an ancestor submodule.
- A separate module procedure cannot be defined more than once.
- A separate module procedure must have the same characteristics and dummy argument names as its corresponding module procedure interface body.
- If you specify a binding label for a separate module procedure, the binding label must be the same as that is specified in the corresponding module procedure interface body.
- You must specify the RECURSIVE prefix specifier for a separate module procedure if and only if it is also specified for the corresponding module procedure interface body.
- When a separate module procedure is a function, the following
rules apply to the result variable:
- If it is defined by a separate module subprogram, the result variable name is determined by the FUNCTION statement in the corresponding module procedure interface body.
- If it is defined by a function subprogram with the MODULE prefix specifier, the result variable name is determined by the FUNCTION statement of the subprogram.
For how the MODULE prefix specifier is used for a function or subroutine subprogram, see FUNCTION or SUBROUTINE.