2017-06-22 88 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正是我所需要的。以前从未见过。谢谢。 –

相关问题