有没有办法区分两个不同的fortran90模块中同名的子程序?

时间:2017-06-22 13:59:44

标签: module fortran fortran90 subroutine

如果我不幸不得不使用两个具有共同子程序名的不同Fortran90模块,有没有办法区分这两个子程序?

1 个答案:

答案 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