Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
26747 Discussions

Procedures as arguments in subroutine calls


I have a program where many of the subroutines have procedures in the argument list.
Many of the subroutines have the same procedures passed.
Each subroutine has an INTERFACE for explicit declaration of the procedures.

I thought I could put these interfaces in a module and then USE the module in the subroutines.
This failed.
I had to also include the line: PROCEDURE(procname) :: MY_FUNC.

Is this according to the standard?

I have included a sample program that shows the same behaviour.
My compiler is: Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version Build 20191121
Windows 10.

Svein-Atle Engeseth


0 Kudos
3 Replies
Black Belt

On line 20, replace INTERFACE by ABSTRACT INTERFACE, and on line 88 write the correct syntax for IMPORT, and then your program will be OK.

Hi, Thanks for the answer. My point was: Why is it necessary to have the line: PROCEDURE(name) :: FUNC. If I change to an abstract interface, this line is still necessary. Why shouldn't the USE statement be equivalent to having the interfaces in the subroutine? The IMPORT is written correctly. Regards,
Black Belt

If you do not specify "ABSTRACT", you are declaring an interface to one specific subprogram such as FUNC. With ABSTRACT, you are declaring an interface to a class of procedures FUNC1, FUNC2,..., all of which have the same interface.

An analogy: we can define a data type. Such a definition does not create any variables of that type, so declarations of variables must also be given. An abstract interface defines the characteristics of a type of procedure, i.e, a procedure code type, rather than data. The procedure(proc) declaration declares one procedure of that type.

I think that the ONLY clause in the IMPORT statement was added for F2018.