Visible to Intel only — GUID: GUID-C8FCAE29-49DA-475C-9EC2-BA2E59C459E0
Visible to Intel only — GUID: GUID-C8FCAE29-49DA-475C-9EC2-BA2E59C459E0
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 This kind of procedure is explicit in a scoping unit other than its own if an interface body for the procedure is supplied or is accessible. |
The interface of a recursive subroutine or function is explicit within the subprogram that defines it.
An explicit interface can come from any of the following:
An interface block
The procedure's definition in a module
An internal procedure
A procedure must not access through use association its own interface.
An abstract interface lets you give a name to a set of characteristics and argument keyword names that create an explicit interface to a procedure. It does not declare any actual procedure to have those characteristics.
Depending on the characteristics of the procedure and its dummy arguments, an explicit interface may be required to be visible to its caller. For more information see Procedures that Require Explicit Interfaces.
You can use a PROCEDURE declaration statement to declare procedure pointers, dummy procedures, and external procedures. It specifies the EXTERNAL attribute for all procedure entities in the procedure declaration list.
You can use the IMPORT statement to make host entities accessible in the interface body of an interface block.
You can specify the ALLOCATABLE, OPTIONAL, or POINTER attributes for a dummy argument in a procedure interface that has the BIND attribute.
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