non-member operators of .so imported into root

From: stefan kluth (skluth@mh1.lbl.gov)
Date: Wed May 20 1998 - 05:24:09 MEST


Hi,

I am trying to attach CLHEP Hep3Vector to root. I worked out most of the
neccessary code changes, and I can produce a shared library which I can
load into root. But a few questions remain:

o) It seems impossible to get non-member operators (i.e. operators like
   "operator+" which are traditionally declared outside the class) to be
   recognised in root. I got the "operator+" only working by making it a
   member of "class Hep3Vector". Is this to be expected?

o) I also found that using "inline" to make e.g. the definition of
   "operator+" inline wreaked havoc in root. For example, when the default
   constructor of Hep3Vector is "inline" I get:
root [2] Hep3Vector v1
 *** Break *** segmentation violation
 *** Break *** keyboard interrupt
Root > .q
   The same happens for the invocation of other member functions of
   Hep3Vector. I could get all the operations in Hep3Vector to work by
   removing "inline" everywhere. Is this normal?

o) An aside, I found that placing "ClassDef(Hep3Vector,1)" at the end of
   the "public:" section of class Hep3Vector, after about 20 or so member
   function declarations, gave me:
[online04] ~/scratch/CLHEP > rootcint -f ThreeVectorCint.cc -c
ThreeVector.h LinkDef.h
Error: Too many '}' FILE:ThreeVector.h LINE:183
   Moving "ClassDef(Hep3Vector,1)" to the top of the "public:" section
   cured this problem. All the root examples put the ClassDef macro at the
   end, so I am not shure if this will cause other problems for me. 

o) Another "feature" is that root sometimes prints some extra stuff when I
   use Hep3Vector operations:
root [2] Hep3Vector v1
root [3] Hep3Vector v2=  Hep3Vector(2,2,2)
root [4] Hep3Vector v3
root [5] v3=v1+v2
(class Hep3Vector)5377455048
root [6] 
   I am referring to the "(class Hep3Vector)5377455048". Does this
   indicate a problem of some sort? 
   
cheers, Stefan

---Stefan Kluth---------------Lynen Fellow----------------|\--|\-------
-  LBNL, MS 50A 2160       -  phone:  +1 510 495 2376  -  |/  |/      -
-  1 Cyclotron Rd.         -  fax:    +1 510 495 2957  -  |\/\|\/\|'  -
---Berkeley, CA94720, USA-----e-mail: SKluth@lbl.gov------|/\/|/\/|----



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:33 MET