Procedure Interfaces

Every procedure has an interface, which consists of the name and characteristics of a procedure, the name and characteristics of each dummy argument, and the generic identifier (if any) by which the procedure can be referenced. The characteristics of a procedure are fixed, but the remainder of the interface can change in different scoping units.

If these properties are all known within the scope of the calling program, the procedure interface is explicit; otherwise it is implicit (deduced from its reference and declaration). The following table shows which procedures have implicit or explicit interfaces:

Kind of Procedure

Interface

External procedure

Implicit 1

Module procedure

Explicit

Internal procedure

Explicit

Intrinsic procedure

Explicit

Dummy procedure

Implicit 1

Statement function

Implicit

1 Unless an interface block is supplied for the procedure.

The interface of a recursive subroutine or function is explicit within the subprogram that defines it.

An explicit interface can appear in a procedure's definition, in an interface block, or both. (Internal procedures must not appear in an interface block.)

The following sections describe when explicit interfaces are required, how to define explicit interfaces, and how to define generic names, operators, and assignment.

Examples

An example of an interface block follows:

INTERFACE

SUBROUTINE Ext1 (x, y, z)

REAL, DIMENSION (100,100) :: x, y, z

END SUBROUTINE Ext1

SUBROUTINE Ext2 (x, z)

REAL x

COMPLEX (KIND = 4) z (2000)

END SUBROUTINE Ext2

FUNCTION Ext3 (p, q)

LOGICAL Ext3

INTEGER p (1000)

LOGICAL q (1000)

END FUNCTION Ext3

END INTERFACE