CINT unable to call member function overloading base class without dictionary

From: Nick West <n.west1_at_physics.ox.ac.uk>
Date: Tue, 5 Feb 2008 08:11:33 -0000


Dear Roottalk,

We have come across a problem where from CINT we are unable to call methods of a class that has been built with its rootcint dictionary. It only occurs when the class subclasses one that does not have a dictionary and the method called overrides a method in the base class.

For example if we have class A:-

class A {

public:
  A() {}
  virtual ~A() {}
  virtual void Speak();
};

and a subclass B:-

class B : public A {

public:
  B() {}
  virtual ~B() {}
  virtual void Speak();
  virtual void Talk();
  ClassDef(B,0)
};

method Talk() can be called as it doesn't override anything in A but attempting to use B::Speak() fails:-

  Error: Speak() header declared but not defined (tmpfile):1:

This used to work, at least as late as 5.12, but perhaps we were lucky and the case where a subclass has a dictionary but its base class does not, isn't supported. If this case is supposed to work then the following little tar file, which builds a shareable library from A.h, A.cxx and B.h, B.cxx demonstrates the problem. To test:-

  1. Create a scratch directory
  2. Setup ROOTSYS as required
  3. Unwind the tar file and type

      ./test.sh

and should produce:-

CINT/ROOT C/C++ Interpreter version...
Type ? for help. Commands must be C++ statements. Enclose multiple statements between { }.

B                                                            <== This is
calling B:Talk()
Error: Speak() header declared but not defined (tmpfile):1: <== This is calling B:Speak()
*** Interpreter error recovered ***

Thanks,

Nick West.  

Received on Tue Feb 05 2008 - 09:11:52 CET

This archive was generated by hypermail 2.2.0 : Tue Feb 05 2008 - 11:50:01 CET