2017-06-22 85 views
0

如果我不幸得不得不使用兩個不同的Fortran90模塊,它們的子程序名稱是相同的,有沒有辦法區分這兩個子程序?有兩種不同的fortran90模塊可以區分同名子程序嗎?

+0

和BTW這裏有這裏重複相當大的潛力,但我沒有還沒有檢查。像使用「私人」和「唯一」的東西應該是顯而易見的。 –

+0

@VladimirF在發佈之前,我檢查了類似的問題。沒有找到任何東西。 –

+0

在這種情況下,請參閱答案。 –

回答

1

您可以使用only

module m1 
contains 
    subroutine sub 
    end subroutine 

    subroutine other_m1 
    end subroutine 
end module 

module m2 
contains 
    subroutine sub 
    end subroutine 

    subroutine other_m2 
    end subroutine 
end module 

    use m1, only: sub, other_m1 
    use m2, only: other2 

    call sub 
end 

也可以重命名其中的一個在use聲明:

use m1 
    use m2, some_other_name => sub 

    call sub 
end 
+0

第二次sol'n正是我所需要的。以前從未見過。謝謝。 –

相關問題