Reputation: 430
I stumbled with a way to run in a child module a procedure of the father. I mean, the trick allow me to run a process in a upstream way, in relation with the dependencies tree of the modules. In concrete, here is the example:
module parent
procedure(likefoo),pointer :: to_foo
interface
subroutine likefoo
end subroutine likefoo
end interface
contains
subroutine run
call to_foo
end subroutine
end module
module child
use parent
contains
subroutine foo
print *, 'hola'
end subroutine foo
end module
program main
use parent
use child
to_foo => foo
call run
end program
This example was positive tested with ifort 13.0.0. I wonder, This code is allowed by the standard or just it run ok because is a compiler dependence feature?. Thanks for your help.
Upvotes: 0
Views: 337
Reputation: 21431
The approach is fine (using F2003 features), but make the interface for likefoo abstract. The requirement for a directed graph of module dependence is an orthogonal concept to the nesting of calls to procedures in those modules.
Upvotes: 1