Question about interfaces and structs

From: Sandra Barsky (s.barsky_at_ucl.ac.uk)
Date: 10/27/04

  • Next message: Richard E Maine: "Re: Question about interfaces and structs"
    Date: Tue, 26 Oct 2004 23:17:55 +0100
    
    

    Hi f9x experts,

    I am trying to write a module which will use one of a number of
    subroutines depending on the dimensionality of the passed variables.

    Example:
    -------------------------------------------
    module foo

    interface calculation
      module procedure scalar,vector,matrix
    end interface calculation

    contains

    subroutine scalar(s)
     end ...
    subroutine vector(v)
     end ...
    subroutine matrix(m)
     end ...

    end module foo
    --------------------------------------------

    the calling program would look like

    --------------------------------------------
    real :: s, v(10),m(10,10)

    calculation(s)
    calculation(v)
    calculation(m)
    ---------------------------------------------

    The above works fine, as sketched. My problem is when I try to write
    something similar with an array of structs.

    eg, if instead of real variables I have structs (with appropriate changes
    in the module) I get the following message in

    g95:
    Generic subroutine 'calculation' at (1) is not an intrinsic subroutine

    and intel fortran:
    There is no matching specific subroutine for this generic subroutine call.
    [calculation].

    Is this somehow built into the spec of the language? Any ideas for
    work-arounds for this?

    Cheers & TIA

    Sandy


  • Next message: Richard E Maine: "Re: Question about interfaces and structs"

    Relevant Pages

    • Controlling the Deletion of a File
      ... I am writing a generic subroutine in VB6 to delete a file. ...
      (microsoft.public.vb.controls)
    • Re: LAPACK95 help!
      ... fortcom: Error: la_test_dgesv.f90, line 35: There is no matching ... specific subroutine for this generic subroutine call. ...
      (comp.lang.fortran)