I am using Fortran 90. I have defined a Fortran module in fileA.f
as:
module getArr
double precision a(100)
end module getArr
The same fileA.f
contains a subroutine that uses this module:
subroutine my_sub
use getArr
implicit none
a(1) = 10.5
end subroutine
In fileB.f
, I have a Fortran function. I am trying to access the value of a(1)
as:
double precision function my_func(R)
use getArr
double precision x
x = a(1)
return
end
But I am getting errors at the compile time. It says it is unable to access the module getArr
. Is this something to do with the use of a module within a function as opposed to within a subroutine ?
How should I declare it?