【发布时间】:2010-05-19 12:58:26
【问题描述】:
我正在使用 Fortran 90。我在 fileA.f 中定义了一个 Fortran 模块:
module getArr
double precision a(100)
end module getArr
同样的fileA.f 包含一个使用该模块的子例程:
subroutine my_sub
use getArr
implicit none
a(1) = 10.5
end subroutine
在fileB.f 中,我有一个 Fortran 函数。我正在尝试访问a(1) 的值:
double precision function my_func(R)
use getArr
double precision x
x = a(1)
return
end
但我在编译时遇到错误。它说它无法访问模块getArr。这与在 function 中而不是在 subroutine 中使用模块有关吗?我应该如何声明我的函数?
【问题讨论】:
标签: fortran