- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Problem occurs when Host is a sub-program. A variable that is a (Host) dummy argument, does not seem to be available to internat procedures. eg:
SUBROUTINE ADAPTIVE( nEin) ! external procedure called from the main
integer nEin, nEQ
nEQ = nEin
call internal()
nEin cannot be accessed in internal, but can access nEQ. Is this correct behaviour ? If so, what is the reason ?
While not a big problem in the example above, it is not so nice when nEin is a very large (multi-MB) array (ie. need two of them).
Alternate is to pass nEin as an argument; ie. call internal (nEin),
But the compiler does not seem to like this if have a derived-type in place of nEin; eg call internal (EQ)
where TYPE(eqRec) EQ(nEQ)
Compiler reports that the actual & dummy arguments are not of the same type (despite identical definitions of eqRec ).
I found after trialling several options that including
TYPE(eqRec) EQ(nEQ)
in the internal without re-declaring "eqRec" (in the internal) does work. This means that "eqRec" (but not EQ) is available to the internal procedure.
Maybe I have not studied the manual hard enough, but I found no
documentation of these features / behaviours. Is this how it supposed to be ?
David
SUBROUTINE ADAPTIVE( nEin) ! external procedure called from the main
integer nEin, nEQ
nEQ = nEin
call internal()
nEin cannot be accessed in internal, but can access nEQ. Is this correct behaviour ? If so, what is the reason ?
While not a big problem in the example above, it is not so nice when nEin is a very large (multi-MB) array (ie. need two of them).
Alternate is to pass nEin as an argument; ie. call internal (nEin),
But the compiler does not seem to like this if have a derived-type in place of nEin; eg call internal (EQ)
where TYPE(eqRec) EQ(nEQ)
Compiler reports that the actual & dummy arguments are not of the same type (despite identical definitions of eqRec ).
I found after trialling several options that including
TYPE(eqRec) EQ(nEQ)
in the internal without re-declaring "eqRec" (in the internal) does work. This means that "eqRec" (but not EQ) is available to the internal procedure.
Maybe I have not studied the manual hard enough, but I found no
documentation of these features / behaviours. Is this how it supposed to be ?
David
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A real example would help - I can guess at some of what you mean, but without seeing a small but complete example, it's very difficult to know what you're seeing and what might be wrong. It's not clear to me that what I think of as an "internal" routine is what you mean by it.
Steve
Steve
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page