I’d like to modify a class of a my software environment, pratically speaking this is an aliroot class (for ALICE) that is still under development, and I need to modify it to be able to run my analysis.
I guess I have to use a patch of that class and compile it by hand with
or something like that.
My problem is that this class is already loaded by default in aliroot, before I perform my on-fly compilation… so when I compile my patched file, I create a second “candidate” of that class, and get a warning from gClassTable.
Finally, when I run my code, (ali)root doesn’t care about my on-fly-compiled class, and uses the one from the library that is loaded by default.
Does it exist a way to make root know which of the two class “candidates” it is supposed to use ?
Many thanks for your help!
[quote]Does it exist a way to make root know which of the two class “candidates” it is supposed to use ?[/quote]In C++ you can not have 2 classes with the same name. In order to be able to use your version, you must not load the first version. If this is not possible, then you will either need to find a solution where instead of replacing the broken class, you derive from it. If derivation will not be sufficient to enable the ‘fixes’ you need, then you will need to simply (?) recompile the Aliroot package that contain that class (after your fixed the problem in the source).
Root 5 does understand namespaces, so you could put the two classes with the same name in different namespaces. That may or may not be more difficult than the fix that Phillip suggested.
Hi thanks for your replies
In my case “not loading” the first version is not possible. A big library containing many basics things is loaded by default, among which the class I must fix.
I cannot recompile the main source because I’ll run on GRID where this big library will be already compiled and deployed : no user access to source code.
But maybe the derivation is possible in my private version, I’ll consider that option.
I cannot access the ‘first’ version of the class source code, so cannot put it into a namespace.
Only my private version of the class can be modified and put into a namespace : will that trick work anyway ?
(i’m not an namespace expert )
many thanks !