Re: Passing module procedures to external procedures -- type issues
  Home FAQ Contact Sign in
comp.lang.fortran only
 
Advanced search
POPULAR GROUPS

more...

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

Group: comp.lang.fortran · Group Profile
Author: robert.corbett
Date: Sep 19, 2008 22:16

On Sep 19, 10:06 pm, robert.corb...@sun.com wrote:
> On Sep 19, 6:52 pm, Rich Townsend barVOIDtol.udel.edu> wrote:
>
>
>
>> Hi all --
>
>> Consider the following module:
>
>> ---CUT---
>> 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---
>
>> (FYI, this is a cut-down version of a more extended code; the external
>> subroutine QAG, for which an explicit interface is *not* defined, is part of
>> QUADPACK).
>
>> This compiles fine with Intel Fortran (Linux), but on gfortran 4.3.1, I get the
>> following error:
>
>> foo.f90:15.24:
>
>> call QAG(other_sub)
>> 1
>> Error: Symbol 'other_sub' at (1) has no IMPLICIT type
>
>> I don't really understand what this error message means; surely, the other_sub
>> name uniquely identifies a subroutine throughout the whole module? 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.

BTW, your code would be standard-conforming if you
removed the IMPLICIT NONE statement, but it might not
do what you expect.

Bob Corbett
no comments
diggit! del.icio.us! reddit!