Purpose
The INTERFACE statement is the first statement of an interface block, which can specify an explicit interface for an external or dummy procedure.
Format
>>-INTERFACE--+--------------+--------------------------------->< '-generic_spec-' |
>>-+-generic_name---------------------+------------------------>< +-OPERATOR--(--defined_operator--)-+ '-ASSIGNMENT--(-- = --)------------' |
Rules
If generic_spec is present, the interface block is generic. If generic_spec is absent, the interface block is nongeneric. 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.
+---------------------------------Fortran 95---------------------------------+
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.
+-----------------------------End of Fortran 95------------------------------+
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.
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