Compiling shared library with Minuit2


I’m compiling a shared library for a class which inherit from ROOT::Minuit2::FCNBase without luck. My class begins like this:

class TchannelFitter:public ROOT::Minuit2::FCNBase { 
    TchannelFitter(Event * initialEvent=0){ 
      std::cout << "constructor of TchannelFitter" << std::endl;

It compiles, generates dictionary etc (initially it complained dictionary for ROOT::Minuit2::GenericFunction couldn’t be found so I generated it too) but it crashes when destructor is called. In fact there’s a problem when the class is constructed already: the constructor can take one argument but if I try to pass that argument

TypeError: TchannelFitter::TchannelFitter() =>
    takes at most 0 arguments (1 given)

so something is going wrong… I thought maybe the class has to inherit from TObject and tried multiple inheritance too but this didn’t work either. I tried inheriting from TObject only and that seem to work OK but of course that doesn’t really help what I want to do with this class (must inherit from FCNBase). I’m out of ideas now how to find what the problem is. I’m suspecting something about dictionary generation is broken. If I create the class with no argument (since it doesn’t recognize it), it crashes when destructor is called

#7  0x011d5feb in sighandler () from /.data/data/akira/Analysis/root/lib/
#8  <signal handler called>
#9  0x00510985 in ROOT::delete_TchannelFitter () from /.data/data/akira/Analysis/Momo/Core/STFitter/
#10 0x01156d42 in TClass::Destructor () from /.data/data/akira/Analysis/root/lib/
#11 0x002cb3d7 in PyROOT::op_dealloc_nofree () from /.data/data/akira/Analysis/root/lib/
#12 0x002cb4d5 in PyROOT::(anonymous namespace)::op_dealloc () from /.data/data/akira/Analysis/root/lib/
#13 0x00b5dbab in subtype_dealloc (self=0xb7163e9c) at Objects/typeobject.c:703
#14 0x00b3ce00 in frame_dealloc (f=0xe546fdc) at Objects/frameobject.c:418

Could you give me some help?

Thanks for your help in advance.


can you please send me all your code, so I can have a look at it,
thank you



Just for the record, problem was pointed out by Lorenzo through private communication:

I had
virtual double operator () (const std::vector&);

where it should be
virtual double operator () (const std::vector&) const;

Many thanks.