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

Is there a way to distinguish between subroutines of the same name in two different fortran90 modules?

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

您可以使用 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