Stand With Ukraine

Saturday, September 11, 2010

Fortran 90 pass subroutine as an argument to the other subroutine

In fortran 90 it is not enough to just declare(unless the passed function has parameters):


as it is in fortran 77. It actually compiles by pgf90 but does not run (worked for the function which did not take any arguments).
You should actually include interface description for it to work in f90:


Update: This appeared also to be the case when passing to a subrouting allocatable array which is supposed to be initialized inside the subroutine. And also, as I understood from the posts of smart people, it is not necessary to describe the interface of the called subroutine if it is declared inside a module.
Below is the example of a subroutine parameter which has an allocatable array as one of the arguments: