Yes, one passes the address of the procedure. By contrast, with
procedure pointers, you pass the address of the pointer variable,
which contains the address of the procedure. Example usage:
module m
subroutine p()
print *, 'Hello'
end subroutine p
subroutine foo (f, g)
procedure() :: f
procedure(), pointer :: g
call f()
call g()
end subroutine foo
end module m
program test
use m
procedure(), pointer :: proc_ptr
proc_ptr => p
call foo (p, proc_ptr)
end program test
Here, "p" is the passed procedure, "proc_ptr" is a pointer variable,
which contains the address of "p".
Note that Equivalent to using
procedure() :: f
the following:
external f
A better choise is to use:
procedure(p) :: f
procedure(p), pointer :: g
Then the interface is known to the compiler. The first line is
equivalent to
interface
subroutine f()
end subroutine f
end interface
The other line is equivalent to the following, but I think not all
compilers support it:
interface
subroutine g()
end subroutine g
end interface
pointer :: g
The procedure statement - and procedure pointers - are Fortran 2003
features. By now, most compilers have implemented it. I know that
gfortran supports it (full support since 4.5). Also g95 supports it
since years, though it does not seem to support the last version.
Tobias