Celevic,
Don't declare h inside f. f already knows about h since it is in the same
module. When you declare h inside f, it becomes a local variable unrelated
to the module function.
Ron Sverdlove
SUBSCRIBE COMP-FORTRAN-90 celevic wrote:
> On Wed, 20 Aug 2003 15:14:36 -0400, Aleksandar Donev
> <[log in to unmask]> wrote:
>
> >Aleksandar Donev wrote:
> >
> >> In Fortran 90 global variables are done via modules:
> >I forgot to say--this is not really a good (meaning clean and nice)
> solution
> >to your problem, but it is simple enough and will likely work for you.
> >
> >Best,
> >Aleks
>
> Aleks, thank you for your reply!
> I tried the program with a simple operation, not the integration.
> I ran it (with compaq visual fortran), but there are 2 errors about the
> external linking (no errors in compiling):
>
> Linking...
> funct.obj : error LNK2001: unresolved external symbol _H@4
> Debug/cele.exe : fatal error LNK1120: 1 unresolved externals
> Error executing link.exe.
> the program is:
>
> module shared
> implicit none
> real :: x_copy
> contains
>
> FUNCTION f(x)
> real, intent(in):: x
> real :: f,h
> x_copy=x
> f=h(2)
> END FUNCTION
>
> FUNCTION h(y)
> real, intent(in) :: y
> real :: h
> h=(x_copy*y)*(y**2)
> END FUNCTION
>
> end module shared
>
> program prova
> use shared
> implicit none
> real :: a
> end program
>
> what is the problem?
> Thank you again,
> celevic
|