On Wed, 20 Aug 2003 21:50:53 -0400, Alvaro Fernandez <alvaro@ATHENA-
ENG.COM> wrote:
>Try putting the external statement further up, in the declaration section
of
>the module.
>or you can put it in the same function you have it now, also _in the
>declaration section._
>[Module unchanged from how you have it...]
Hi Alvaro, thank you for your reply.
I tried putting the external statement either in the declaration
section of the module or in the declaration section of the function f(x)
itself, but I receive errors.
IN THE FIRST CASE (corresponding to error 1 in the program below):
Error: The name of the module procedure conflicts with a name in the
encompassing scoping unit. [H]
FUNCTION h(y)
---------^
Error executing df.exe.
funct.obj - 1 error(s), 0 warning(s)
IN THE SECOND CASE (error 2 in the program below):
Linking...
funct.obj : error LNK2001: unresolved external symbol _H
funct.obj : error LNK2001: unresolved external symbol _QDAG@16
Debug/cele.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
cele.exe - 3 error(s), 0 warning(s)
I don't understand how to declare correctly h as external also because if
I don't declare h external (at all) I receive the error:
Linking...
funct.obj : error LNK2001: unresolved external symbol _QDAG@16
Debug/cele.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Thank you for the help!
celevic
here is the program:
MODULE shared
implicit none
real :: x_copy
external h <-------------- ERROR 1
contains
FUNCTION f(x)
real, intent(in):: x
real :: f
real :: lower=1.,upper=10.
real :: res
external h <-------------- ERROR 2
x_copy=x
call QDAG(h,lower,upper,res)
f=res
END FUNCTION
FUNCTION h(y)
real, intent(in) :: y
real :: h
h=(x_copy*y)*(y**2)
END FUNCTION
END MODULE shared
PROGRAM proof
use shared
real :: a,b
do a=1.,5.,1.
b=f(a)
write(*,*) b
enddo
END PROGRAM
|