Syntax for passing an external function into a contained function?



I'm trying to call an external function from a contained function in my
subroutine, but no syntax seems to work, I keep getting unresolved
externals:

main.for
external ftest
call sub1(ftest)
end

sub1.for
subroutine sub1(func)
real*8 func
x = func1(n)
...
contains
real*8 function func1(n)
func1 = func(n)
return
end

ftest.for
real*8 function ftest(n)
ftest = ...
return
end

The linker fails saying func is an unresolved external in func1 but it
shouldn't be looking for func, rather ftest which is in the project.

.



Relevant Pages

  • Re: How to avoid forward references in Modules?
    ... favored avoiding nesting when it was not clearly superior ... If the problem of interface checking of those externals ... The following method seems to work on Intel Fortran 8 for solving the problem of interface checking of externals, although I don't think the standard requires that the compiler do the relevant checking, and I don't know how widespread this checking actually is: ... subroutine this ...
    (comp.lang.fortran)
  • Re: Program Fails When Parameter Fixed Constants are Changed (F77) ??
    ... that type is what the compiler was bitching about. ... these say anything about being a function versus subroutine. ... like externals at all. ... That is not the same thing as being valid f77. ...
    (comp.lang.fortran)
  • Externals in modules
    ... I have a question to externals in modules, ... subroutine fun ... public ruku ... double precision y,h,f ...
    (comp.lang.fortran)
  • Re: compilation cascades (yet again)
    ... > We imagine subprogram libraries being written ... > precompiled and whose interfaces are collected ... subroutine a ... program calls externals but checks their interfaces ...
    (comp.lang.fortran)
  • Re: Syntax for passing an external function into a contained function?
    ... > subroutine, but no syntax seems to work, I keep getting unresolved ... Do you need to reference func, not func1? ...
    (comp.lang.fortran)