class SomeOtherClass {};
class A : public TObject
{
public:
A(SomeOtherClass &b, Int_t y, Int_t z) {
printf("this,b,y,z = %p,%p,%d,%d\n",this,&b,y,z);
}
A &func(SomeOtherClass &b, Int_t y, Int_t z) {
printf("this,b,y,z = %p,%p,%d,%d\n",this,&b,y,z);
return *this;
}
ClassDef(A,1);
};
#include "TClass.h"
#include "TMethodCall.h"
#include "TString.h"
#include "TROOT.h"
int mc() {
TClass* c = TClass::GetClass("A");
TMethodCall call;
call.InitWithPrototype(c,"func","SomeOtherClass&,Int_t,Int_t");
if ( call.IsValid() )
{
SomeOtherClass b;
printf("&b = %p\n",&b);
TString params; params.Form("*((SomeOtherClass*)0x%p),%d,%d",&b,1,3);
Long_t rl;
A *a =reinterpret_cast( gROOT->ProcessLineFast(Form("new A(*((SomeOtherClass*)0x%p),%d,%d",&b,1,3)));
call.Execute(a, params,rl);
a = 0;
a = reinterpret_cast(rl);
printf("result = %p\n",a);
} else {
printf("Function not found\n");
}
return 0;
}