INTERFACE problem

Steve Kargl sgk@troutmask.apl.washington.edu
Thu Mar 9 17:05:00 GMT 2006


On Thu, Mar 09, 2006 at 09:34:22AM -0700, Michael Webb wrote:
> 
> Module IntTest2
> 
> IMPLICIT NONE
> 
> CONTAINS
> 
>      SUBROUTINE mytest(myfunc,x,s)
>          INTERFACE
>            FUNCTION myfunc(x,a,b)
>               REAL(8)  x,a,b
>            END FUNCTION myfunc
>          END INTERFACE
> 
>          REAL(8), INTENT(IN) :: x
>          REAL(8), INTENT(OUT) ::  s
> 
>          REAL(8)  a,b
> 
>          s=myfunc(x,a,b)
> 
>      END SUBROUTINE mytest
> 
> END MODULE IntTest2
> 
> and here's the compiler response (using MINGW on Windows):
> 
> g95 -c -Wall -O3 -MMD -o IntTest2.o ../src/IntTest2.F90
> In file ../src/IntTest2.F90:11

g95 is not gfortran.  You have the wrong mailing list.

With gfortran your code gives,

troutmask:kargl[204] gfc -c f.f90
 In file f.f90:7

     SUBROUTINE mytest(myfunc,x,s)
                            1
Error: Symbol 'myfunc' at (1) has no IMPLICIT type

In looking at your code, you need have used "IMPLICIT NONE"
and you don't declare the return type form myfunc.  If
you add "REAL(8) myfunc" to the interface, then gfortran
compiles your code.

I don't know what g95 does.

-- 
Steve



More information about the Fortran mailing list