accing a fortran 'module' in a 'function defined in some other file

Posted by cppb on Stack Overflow See other posts from Stack Overflow or by cppb
Published on 2010-05-19T12:58:26Z Indexed on 2010/05/19 13:20 UTC
Read the original article Hit count: 226

Filed under:
|

hello,

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

   getArr%a(1) = 10.5

end subroutine

In fileB.f, I have a fortrtan function. I am trying to access the value of getArr%a(1) as:

double precision function my_func(R) use getArr double precision x x = getArr%a(1)

return end

But I am getting errors at the compile time. It says it is unable to access the module getArr.

How should I declare it??

Thanks

© Stack Overflow or respective owner

Related posts about beginner

Related posts about fortran