PROCEDURE
Purpose
A PROCEDURE statement that appears within a generic interface adds the specified procedures to the generic interface.
Syntax
Rules
A MODULE PROCEDURE statement can appear anywhere among the interface bodies in an interface block that has a generic specification.
A PROCEDURE statement can only appear in an interface block that has a generic specification.
When MODULE is not specified, procedure_name_list must refer to an accessible procedure pointer, external procedure, dummy procedure, or module procedure that has an explicit interface. When MODULE is specified for PROCEDURE, procedure_name_list must refer to a module procedure that is accessible in the current scope.
A procedure_name must not specify a procedure that is specified previously in any PROCEDURE statement in any accessible interface with the same generic identifier.
Examples
The following example shows how to declare and use a PROCEDURE statement in a generic interface:
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