Print

Print


Colin Millar writes:
 > Thanks in advance for any advice.

One piece of advice would be to also include the error message
yu are getting...but I think I can make do without it here.
....
 >   INTERFACE ASSIGNMENT (+)
 >    TYPE(CompNum) FUNCTION Complex_Add(Comp1,Comp2)
 >
 >         TYPE(CompNum), INTENT(IN) :: Comp1, Comp2
 >    END FUNCTION Complex_Add
 >   END INTERFACE
....

Since the function complex_add is a module procedure, the compiler
already knows it's interface.  You don't need to write out an
interface body for it.  Indeed, you aren't allowed to.  Assuming
you got past the other hurdles (which are probably what are generating
the unspecified error messages), you'd find that this interface
body means something entirely different from what you intended.
Putting an interface body here means to use an *EXTERNAL* procedure
of that name.  There is no such external procedure (a module
procedure is not an external one).

So just use

   INTERFACE ASSIGNMENT (+)
    module procedure Complex_Add
   END INTERFACE

and likewise for all the other cases.

There are a bunch of complications relating to interface bodies...but
since you don't need interface bodies here, you don't need to get into
their complications.  (The interface body is the part that I took out
and replaced by the module procedure statement above; the whole thing
is an interface block).

If you were needing to use interface bodies, you'd have the problem
that interface bodies do not inherit things (notably the definition
of the CompNum type) by host association, so you have to find
another way to get that definition into them.  You can't just
duplicate the definition and you can't have a USE of the module
inside of the module iteself.  So you get driven to workarounds like
making two separate modules, which in turn has problems if the
derived type has private components.  This is a widely discussed
issue, with proposals to make a better way in f2k.  But you don't
need to get into all that mess.

--
Richard Maine                |  Good judgment comes from experience;
[log in to unmask]   |  experience comes from bad judgment.
                             |        -- Mark Twain