[ROOT] Segfault when passing a function pointer into a compiled class...

From: Will Robinson (wsr23@stanford.edu)
Date: Fri Aug 04 2000 - 03:59:43 MEST


I've been using ROOT for most of the summer, and am very pleased with
it.  Up until now, I've been able to get along using only the interpreter,
but recently I've had to start compiling some of my classes to gain speed
and I/O functionality.  

I've hit a very frustrating snag: one of my compiled classes takes a
function pointer as one of the parameters in its constructor.  Nothing
fancy, just something like Double_t (*weightFn)(Float_t).  The problem is
that when I try to use this function within the class, I get a
segmentation fault.  I spent a couple of hours staring at the screen,
trying to find a syntax error or *something*.  Finally I created a tiny
little dummy class, which took the same type of function pointer in its
constructor and just output the value returned from that function.  I
loaded it in the interpreter with a .L and was able to use it as I would
like to.  Then I opened up that dummy class, added a ClassDef() to the .h
file and a ClassImp() to the .cxx file, and made the class inherit from
TObject.  I compiled the class in, and tried again.  When compiled, this
class also segfaulted when trying to call the function specified by the
function pointer.

So somewhere in the process of compilation something got screwed up.  I'm
running ROOT 2.24/05.  I'm running MINFAST on top of this, but in these
particular classes there is no MINFAST-specific code.

Please help me out of this jam!

Thanks,
Will Robinson
wsr23@stanford.edu



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:30 MET