TInterpreter::Execute and parameters passed by reference

Hello,

I wonder whether/how TInterpreter::Execute can cope with functions that have parameters passed by reference. Such as

How could I obtain, via TInterpreter::Execute, x any y coordinates of let’s say the first point of TGraph?

Thanks a lot, Kašpi.

Hi,

You can use something likeTString::Format("%d, *(int*)0x%x, *(int*)0x%x",i,&x,&y);

Cheers,
Philippe.

Thank you very much for your help. I tried that, but I was not successful. Could you please look at the following code?

#include "TGraph.h"
#include "TString.h"
#include "TInterpreter.h"

int main()
{
	TGraph *g = new TGraph();
	g->SetPoint(0, 1, 2);
	double x = -1, y = -1;

	int error = 0;

	int i = 0;
	gInterpreter->Execute(g, g->IsA(), "GetPoint", (const char *) TString::Format("%d, *(int*)0x%x, *(int*)0x%x", i, &x, &y), &error);

	printf("error = %i, x = %f, y = %f\n", error, x, y);
}

The program prints error = 0, x = -1.000000, y = -1.000000
No error is signalized but this may be the same issue as in my other post.

Would you know where the problem is?

Thanks again, Kašpi.

Hi,

The call has to be tweaked a bit:gInterpreter->Execute(g, g->IsA(), "GetPoint", TString::Format("%d, *(double*)0x%lx, *(double*)0x%lx", i, &x, &y), &error)

Cheers,
Philippe.