Re: Syntax for passing an external function into a contained function?



ferrad wrote:
....
> subroutine sub1(func)
> real*8 func
> x = func1(n)
> ...
> contains
> real*8 function func1(n)
> func1 = func(n)
> 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.

After the line declaring fiunc (REAL*8 isn't standard by the way),
you might add:

EXTERNAL func

Or you might declare func as:

REAL(KIND(0.0d0)),EXTERNAL :: func

--
J. Giles

"I conclude that there are two ways of constructing a software
design: One way is to make it so simple that there are obviously
no deficiencies and the other way is to make it so complicated
that there are no obvious deficiencies." -- C. A. R. Hoare


.



Relevant Pages

  • Re: spin_lock_irqsave in functions
    ... Locks don't protect functions, they protect data. ... Assuming that func() and func1() both use data protected by xx, ... Now this assumes that all callers of func1must hold the lock. ...
    (comp.os.linux.development.system)
  • spin_lock_irqsave in functions
    ... Will there be any deadlock on SMP? ...
    (comp.os.linux.development.system)
  • Re: Syntax for passing an external function into a contained function?
    ... > subroutine sub1 ... The internal procedure gets the declaration ... FUNC itself. ... no deficiencies and the other way is to make it so complicated ...
    (comp.lang.fortran)
  • Re: external procedure
    ... real, external:: func ... specify func in the main program as external. ... declaration in the main program overrides the declaration in ... no deficiencies and the other way is to make it so complicated ...
    (comp.lang.fortran)