INTERFACE
Purpose
The INTERFACE statement is the first statement of an interface block, which can specify an explicit interface for an external or dummy procedure.
Syntax
- generic_spec
- is
- defined_operator
- is a defined unary operator, defined binary operator, or extended intrinsic operator
Rules
If generic_spec is present, the interface block is generic. If generic_spec and ABSTRACT is absent, the interface block is specific. An interface block introduced by ABSTRACT INTERFACE is an abstract interface block. generic_name specifies a single name to reference all procedures in the interface block. At most, one specific procedure is invoked each time there is a procedure reference with a generic name.
An interface body in a generic or specific interface block specifies the EXTERNAL attribute and an explicit specific interface for an external procedure or a dummy procedure. If the name of the declared procedure is that of a dummy argument in the subprogram containing the interface body, the procedure is a dummy procedure; otherwise, it is an external procedure.
If a generic_spec appears in an INTERFACE statement, it must match the generic_spec in the corresponding END INTERFACE statement.
If the generic_spec in an INTERFACE statement is a generic_name, the generic_spec of the corresponding END INTERFACE statement must be the same generic_name.
An INTERFACE statement without a generic_spec can match any END INTERFACE statement, with or without a generic_spec.
A specific procedure must not have more than one explicit interface in a given scoping unit.
You can always reference a procedure through its specific interface, if accessible. If a generic interface exists for a procedure, the procedure can also be referenced through the generic interface.
If generic_spec is OPERATOR(defined_operator), the interface block can define a defined operator or extend an intrinsic operator.
If generic_spec is ASSIGNMENT(=), the interface block can extend intrinsic assignment.
If generic_spec is dtio_generic_spec,
the interface block defines derived type input/output procedures.
User-defined derived type input/output procedures allow your application
to override the default handling of derived type objects and values
in data transfer input/output statements. The subroutines in this
interface block must have interfaces described in User-defined derived-type Input/Output procedure interfaces (Fortran 2003). 
Examples
INTERFACE ! Nongeneric interface block
FUNCTION VOL(RDS,HGT)
REAL VOL, RDS, HGT
END FUNCTION VOL
FUNCTION AREA (RDS)
REAL AREA, RDS
END FUNCTION AREA
END INTERFACE
INTERFACE OPERATOR (.DETERMINANT.) ! Defined operator interface
FUNCTION DETERMINANT(X)
INTENT(IN) X
REAL X(50,50), DETERMINANT
END FUNCTION
END INTERFACE
INTERFACE ASSIGNMENT(=) ! Defined assignment interface
SUBROUTINE BIT_TO_NUMERIC (N,B)
INTEGER, INTENT(OUT) :: N
LOGICAL, INTENT(IN) :: B(:)
END SUBROUTINE
END INTERFACE
Related information
- Explicit interface
- Extended intrinsic and defined operations
- Defined operators
- Defined assignment
- User-defined derived-type Input/Output procedure interfaces (Fortran 2003)
- FUNCTION
- SUBROUTINE
- PROCEDURE
- Procedure references
- Unambiguous generic procedure references, for details about the rules on how any two procedures with the same generic name must differ



