Re: Passing module procedures to external procedures -- type issues



On Sep 19, 11:25 pm, nos...@xxxxxxxxxxxxx (Richard Maine) wrote:
<robert.corb...@xxxxxxx> wrote:
On Sep 19, 6:52 pm, Rich Townsend <r...@xxxxxxxxxxxxxxxxxxx> wrote:
module foo

implicit none

contains

subroutine main_sub ()

call internal_sub()

contains

subroutine internal_sub()

call QAG(other_sub)

end subroutine internal_sub

end subroutine main_sub

subroutine other_sub ()

end subroutine other_sub

end module foo
---CUT---
Is my code standard conforming or not?

It is not standard conforming code. As Glen Hermannsfeldt
suggests, you need to either provide an explicit interface
for other_sub or declare it in an EXTERNAL statement. My
guess is that Intel Fortran will report the error to you
if you use the right compiler option.

Either Bob's missing something or I am. From what I can see, the code is
fine as is, but would be erroneous if an EXTERNAL statement or interface
body were added. Did you miss the fact that other_sub is not external,
but is instead a module procedure in the same module.

Yes, I misread his example. I thought other_sub was an
external procedure.

Bob Corbett
.



Relevant Pages

  • Re: More odd code that seems to work
    ... The EXTERNAL statement dates back from the origins of Fortran in the ... There are several ways to get an explicit interface. ... caller - at least I wouldn't use words like that to describe it. ... Those cases where such a deduction cannot be made based solely on the ...
    (comp.lang.fortran)
  • Re: Modules and the use of the EXTERNAL statement in F90
    ... in a module the EXTERNAL statement is not required, ... Because odesys is *not* external: it is a module procedure that is ... Mike Metcalf ...
    (comp.lang.fortran)