Hi Reiner, > and c_int is the same value as c_short. This is surprising (be see below). Could you please send me a tar file reproducing this problem? TClass object are supposed to be unique for each class instance, but can change over the course of execution. To support the ability to read file without the shared library, when you open a TFile, the TClass corresponding to the classes that are in the file but do not have a dictionary in memory will be created. If you then load the library corresponding to this classes, the TClass object created by the TFile will be deleted and the full fledge TClass objects will be created instead. > In the allplication code I call > TClass * c_short = Child<Short_t>::Class(); > and in the shared library code I call > TClass * c_int = Child<Int_t>::Class(); > and c_int is the same value as c_short. This might or might be correct. To assert whether this is really issue or not do: TClass * c_short = Child<Short_t>::Class(); std::cerr << "Got " << c_short->GetName() << " while expecting Child<Short_t>\n"; and in the shared library code TClass * c_int = Child<Int_t>::Class(); TClass * c_short = Child<Short_t>::Class(); std::cerr << "Got " << c_int->GetName() << " while expecting Child<Int_t>\n"; std::cerr << "Got " << c_short->GetName() << " while expecting Child<Short_t>\n"; Cheers, Philippe. -----Original Message----- From: owner-roottalk@pcroot.cern.ch [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Reiner.Rohlfs@obs.unige.ch Sent: Thursday, August 05, 2004 8:35 AM To: roottalk@pcroot.cern.ch Subject: [ROOT] Is classname::Class() unique? Hi ROOT team Assume I have a class called "Base" (derived from TNamed) and a derived template class called "Child". I create two dictionary informations in the LinkDef.h file for the Child class: #pragma link C++ class Child<Short_t>+; #pragma link C++ class Child<Int_t>+; The code of these classes together with the dictionary code is linked in a shared library. Now I use these classes in a linked application program, linked with the shared library of these classes Base and Child: In the allplication code I call TClass * c_short = Child<Short_t>::Class(); and in the shared library code I call TClass * c_int = Child<Int_t>::Class(); and c_int is the same value as c_short. If I call Child<Int_t>::Class() in the application code before I call TClass * c_int = Child<Int_t>::Class(); in the shared library code the values of c_int and c_short are different. Is this what I have to expect or is this a bug? I use ROOT version 4.00.08 and gcc version 2.95.3, SuSE LINUX. Thanks Reiner.
This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:09 MET