Interface blocks define explicit interfaces for external or dummy procedures. They can also be used to define a generic name for procedures, a new operator for functions, and a new form of assignment for subroutines.
An interface block takes the following form:
Defines a generic operator (op). It can be a defined unary, defined binary, or extended intrinsic operator.
Defines generic assignment.
The subprogram must not contain a statement function or a DATA, ENTRY, or FORMAT statement; an entry name can be used as a procedure name.
The subprogram can contain a USE statement.
The characteristics of module procedures are not given in interface blocks, but are assumed from the module subprogram definitions.
Interface blocks can appear in the specification part of the program unit that invokes the external or dummy procedure.
A generic-spec can only appear in the END INTERFACE statement (a Fortran 95 feature) if one appears in the INTERFACE statement; they must be identical.
The characteristics specified for the external or dummy procedure must be consistent with those specified in the procedure's definition.
An interface block must not appear in a block data program unit.
An interface block comprises its own scoping unit, and does not inherit anything from its host through host association.
A procedure must not have more than one explicit interface in a given scoping unit.
A interface block containing generic-spec specifies a generic interface for the following procedures:
Any generic name, defined operator, or equals symbol that appears is a generic identifier for all the procedures in the interface block. For the rules on how any two procedures with the same generic identifier must differ, see Section 16.2.
The module procedures must be accessible by a USE statement.
To make an interface block available to multiple program units (through a USE statement), place the interface block in a module.
The following rules apply to interface blocks containing pure procedures:
Examples
The following example shows a simple procedure interface block with no generic specification:
SUBROUTINE SUB_B (B, FB)
REAL B
...
INTERFACE
FUNCTION FB (GN)
REAL FB, GN
END FUNCTION
END INTERFACE
For More Information: