I have two different modules each one has the same subroutine. main program will call one of them based on a certain condition. I want to avoid renaming each of these subroutine to a different name.
Asked
Active
Viewed 2,107 times
6
-
1You need to post some bare code and have you tried the `USE` statement defining aliases? – John Alexiou Jan 25 '15 at 07:29
1 Answers
10
If you have two modules A
and B
containing the same method foo()
then first you can create a local alias with
program SOModNames
use A, fooA => foo
use B, fooB => foo
implicit none
! Variables
real X(10), Y(10)
call fooA(X,10)
call fooB(Y,10)
end program SOModNames
Unofrtunatelty you cannot scope to a module with call A::foo(X,10)
for example.

John Alexiou
- 28,472
- 11
- 77
- 133
-
Please answer this question too :) http://stackoverflow.com/questions/28134327/fortran-split-mofule-into-multipel-files – Mahmoud Fayez Jan 25 '15 at 07:49