problem with function as argument of procedure
From: Phillip Helbig---remove CLOTHES to reply (helbig_at_astro.multiCLOTHESvax.de)
Date: 11/14/04
- Next message: DrPostman: "Re: Where's Bruce aka Tholen?"
- Previous message: Charles Russell: "no implicit SAVE in gfortran?"
- Next in thread: Phillip Helbig---remove CLOTHES to reply: "Re: problem with function as argument of procedure"
- Reply: Phillip Helbig---remove CLOTHES to reply: "Re: problem with function as argument of procedure"
- Reply: Ron Shepard: "Re: problem with function as argument of procedure"
- Reply: Richard E Maine: "Re: problem with function as argument of procedure"
- Maybe reply: Phillip Helbig---remove CLOTHES to reply: "Re: problem with function as argument of procedure"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 14 Nov 2004 07:43:46 +0000 (UTC)
I've been away from Fortran for a while (but am getting back to it), so
I hope someone can spot my obvious error.
I want to numerically integrate a function. Here's some pseudocode:
MODULE Q_FUNC
PRIVATE
PUBLIC Q
CONTAINS
FUNCTION Q(X)
Q = BLABLABLA(X)
END FUNCTION Q
END MODULE Q_FUNC
PROGRAM MAIN
USE Q_FUNC
INTEGRAL = INTEGRATOR(Q,START,END)
END PROGRAM MAIN
INTEGRATOR contains an INTERFACE for its dummy function argument. Q is
defined to correspond to this exactly.
The error I am gettting is:
%F90-E-ERROR, The characteristics of the associated actual function
result differ from the characteristics of the dummy function result.
(12.4.1.2, 12.2.2) [Q]
This is the DEC/Compaq/HP compiler on VMS (Alpha of course).
(I REALLY like the references to the standard in the error message; I
had a look in the standard but it doesn't help me here.)
My main question is, how can this even be possible? The MAIN program
has access to Q via USE association.
Perhaps I don't understand the error message well enough.
It seems to me that the interface to Q_FUNC from MAIN is explicit, since
it is accessed via USE association.
Q_FUNC and MAIN are in the same file. Surely I don't have to compile
Q_FUNC separately first to get this to work?
(On a related note, my gut feeling is that in this case an internal
procedure would be more appropriate for Q_FUNC, but this is not allowed
(according to M&R, because of the way internal procedures might be
implemented); has this restriction been relaxed in Fortran 2003? It
seems to me that a MODULE used by just one program is a bit of overkill
(which is why I want to include it in the same file, to make it clear
that it is just a one-off thing for the function I want to integrate).)
- Next message: DrPostman: "Re: Where's Bruce aka Tholen?"
- Previous message: Charles Russell: "no implicit SAVE in gfortran?"
- Next in thread: Phillip Helbig---remove CLOTHES to reply: "Re: problem with function as argument of procedure"
- Reply: Phillip Helbig---remove CLOTHES to reply: "Re: problem with function as argument of procedure"
- Reply: Ron Shepard: "Re: problem with function as argument of procedure"
- Reply: Richard E Maine: "Re: problem with function as argument of procedure"
- Maybe reply: Phillip Helbig---remove CLOTHES to reply: "Re: problem with function as argument of procedure"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|