Interface concepts

The interface of a procedure determines the form of the procedure reference. The interface consists of:
  • The characteristics of the procedure
  • The name of the procedure
  • The name and characteristics of each dummy argument
  • The generic identifiers of the procedure, if any
The characteristics of a procedure:
  • Distinguishing the procedure as a subroutine or a function
  • Distinguishing each dummy argument either as a data object, dummy procedure, or alternate return specifier

    The characteristics of a dummy data object are its declared type, type parameters (if any), shape TS 29113 begins(unless it is assumed-rank)TS 29113 ends, intent, whether it is optional, allocatable, polymorphic, a pointer, a target, or has the VALUE or CONTIGUOUS attribute. Any dependence on other objects for type parameter or array bound determination is a characteristic. If a shape, size, or character length is assumed or deferred, it is a characteristic.

    The characteristics of a dummy procedure are the explicitness of its interface, its procedure characteristics (if the interface is explicit), and whether it is optional.

  • If the procedure is a function, it specifies the characteristics of the result value, specifically:
    • Declared type
    • Any type parameters
    • Rank
    • Whether the result value is a pointer
    • Whether the result value is a procedure pointer
    • Whether the result value is allocatable.
    • Whether the result value is polymorphic
    • Fortran 2008 beginsWhether the result value is contiguous.Fortran 2008 ends
    For nonpointer, nonallocatable array results, its shape is a characteristic. Any dependence on other objects for type parameters or array bound determination is a characteristic. If the length of a character object is assumed, this is a characteristic. If type parameters of a function result are deferred, which parameters are deferred is a characteristic.
  • Determine whether the procedure is PURE or ELEMENTAL.
  • Determine if the procedure has the BIND attribute.

If a procedure is accessible in a scoping unit, it has an interface that is either explicit or implicit in that scoping unit. The rules are:

Entity Interface
Dummy procedure Explicit in a scoping unit if an interface block exists or is accessible, or if an explicit interface is specified by a PROCEDURE declaration statement. Implicit in all other cases.
External subprogram Explicit in a scoping unit other than its own if an interface block exists or is accessible, or if an explicit interface is specified by a PROCEDURE declaration statement. Implicit in all other cases.
Recursive procedure with a result clause Explicit in the subprogram's own scoping unit.
Module procedure Always explicit.
Internal procedure Always explicit.
Generic procedure Always explicit.
Intrinsic procedure Always explicit.
Statement function Always implicit.

Internal subprograms cannot appear in an interface block or in a PROCEDURE declaration statement.

A procedure must not have more than one accessible interface in a scoping unit.

The interface of a statement function cannot be specified in an interface block or in a PROCEDURE declaration statement.



Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us