例如,考虑一个具有以下一般结构的模块:
module test
implicit none
contains
function f(x)
...
end function f
subroutine sub()
...
y = f(x)
...
end subroutine
end module test
因此这是不正确的,就像在 a 内部做类似的事情一样program
(内部程序不能相互引用)。当我在一个模块中测试它时,我仍然得到同样的错误。目前我把f
模块放在外面,它可以工作。我对此不满意的原因是我希望f
对使用测试的程序可用;现在它仅可用于在此模块文件中定义的过程。