I’ve got a “dynamic” interface implemented to ROOT - so I can create objects (minus the ctor implementation referenced in another question) and then call the methods on it. Works well. One big limitation currently is if a method needs an argument to another class. For example. TH1::Divide, which takes another TH1* as an argument.
I’ve been using TMethodCall::Execute to tell CINT to do the call. And I pass the arguments as a string. For example, say I have some code similar to below (sorry, it isn’t totally right):
TH1F *h1 = ...
TH1F *h2 = ...
method.InitWithPrototype(TClass::GetClass("TH1F"), "Divide", "TH1F");
I tried soemthing dumb, like
args << h2;
but the access violation was impressive. Is this a limitation of TMethodCall? Perhaps I should use CINT directly somehow (as pyroot seems to do)?
Can you, please, explain, why do you want replace traditional C++ syntax with some function calls?
Do you have to use C++ (ROOT classes) from other language?
Sorry, I should have updated this question. I’m trying to implement pyROOT’s functionality for the .NET world. I was thinking, after reading through ROOT documentation, I didn’t need to go down to the CINT level. Infact, everywhere around I see people like Philippe recommending the Execute method, with string arguments.
In the end, for those that stumble on this question after me, I copied what Wim did in the pyROOT source. He has done it already, so it actually isn’t hard. To get a working implementation took only about 6-8 hours of work. That was without the interpreter lock, and some other corner casses (supporting interpreted classes, etc.).
Like pyROOT, it is relatively slow. Use directly compiled wrappers where possible.
P.S. Axel - I can’t wait for Clang. This stuff will be simpler, right??