MODULE PROCEDURE

Purpose

The MODULE PROCEDURE statement lists those module procedures that have a generic interface.

Syntax

Read syntax diagramSkip visual syntax diagram>>-MODULE PROCEDURE--procedure_name_list-----------------------><
 

Rules

Fortran 95

The MODULE PROCEDURE statement can appear anywhere among the interface bodies in an interface block that has a generic specification.

End of Fortran 95

MODULE PROCEDURE statements must be contained in a scoping unit where procedure_name can be accessed as a module procedure, and must be the name that is accesible in this scope.

procedure_name must not have been previously associated with the generic specification of the interface block in which it appears, either by a previous appearance in an interface block or by use or by host association.

The characteristics of module procedures are determined by module procedure definitions, not by interface bodies.

Examples

MODULE M
  CONTAINS
  SUBROUTINE S1(IARG)
    IARG=1
    PRINT *, "In S1"
  END SUBROUTINE
  SUBROUTINE S2(RARG)
    RARG=1.1
  END SUBROUTINE
END MODULE

USE M
INTERFACE SS
  SUBROUTINE SS1(IARG,JARG)
  END SUBROUTINE
  MODULE PROCEDURE S1, S2
END INTERFACE
CALL SS(N)                   ! Calls subroutine S1 from M
CALL SS(I,J)                 ! Calls subroutine SS1
END
SUBROUTINE SS1(IARG,JARG)
  PRINT *, "In SS1"
END SUBROUTINE SS1

Related information