Defining new operators
- From: Matthew Nobes <nobes@xxxxxxxxxxxxxxxx>
- Date: Thu, 28 Apr 2005 16:55:10 +0000 (UTC)
I'm trying to write some f90 code which uses new types and operators
that I have defined. In the module which defines these, I have
the following
interface operator (.getint.) ! gets the integer part n_x and n_y
module procedure getint
end interface
private :: getint
....
function getint(k)
type(mom), intent(in) :: k
integer, dimension(2) :: getint
getint(1) = k%comps(1)%mint; getint(2) = k%comps(2)%mint
end function getint
If I use this in my main program, it works fine. A "print *, .getint.k"
returns exactly whats expected. However, when I try to use the same
operator in function in another module I get a complier error.
That is, if I put
complex function gluoncolour2(k1,k2)
use mommod
type(mom), dimension(4), intent(in) :: k1,k2
print *, .getpol.k1
gluoncolour2 = 0.0
end function gluoncolour2
in a module, and try to compile that I get
matt@smedley:~/Projects/fermilabpt/tmp $ ifort -c colourmod.f90
fortcom: Error: colourmod.f90, line 15: A unary defined OPERATOR
definition is missi\ng or incorrect. [GETPOL]
print *, .getpol.k1
--------------^
compilation aborted for colourmod.f90 (code 1)
I'm sure I'm doing something dumb here, but I cannot understand what it
is. The new operator works fine when used in the main program...
--
Matthew Nobes | email: nobes@xxxxxxxxxxxxxxxx
Newman Lab, Cornell University | web: http://lepp.cornell.edu/~nobes/
Ithaca NY 14853, USA |
.
- Follow-Ups:
- Re: Defining new operators
- From: James Van Buskirk
- Re: Defining new operators
- Prev by Date: Re: why doesn't this compile ?
- Next by Date: Re: why doesn't this compile ?
- Previous by thread: strange linking problem
- Next by thread: Re: Defining new operators
- Index(es):