Syntax of a free function (or C++ functor) for TGraph fitting

Thanks a lot for the fast answer!
I’ve switched to Root 6 (6.08.00), but with the following example

import ROOT
graph_1 = ROOT.TGraph(n, x_arr, y_arr) #arr created with the array module 

ROOT.gInterpreter.ProcessLine('''
struct MyFunction {
   MyFunction(TGraph & g) : fGraph(&g) {}
   double operator() (double *x, double *) { return fGraph->Eval(x[0]); }
   TGraph * fGraph;
};''')
myf = ROOT.MyFunction(graph_1)
ffree = ROOT.TF1("ffree", myf)
Integral = f1.Integral(0, 0.003)

I get a crash when calling f1.Integral (or also by saving the canvas with the drawn f1).
Because of my limited C++ knowledge, I’ve tried to replace the x (and g) in the struct with x_arr (graph_1), but it also crashed. I think that something with MyFunction is wrong (i.e. it doesn’t return Eval to the TF1), but I don’t know how to fix it.
I’ve attached the log of the crash.
LogCrash.txt (6.31 KB)

Alternatively, with Root6, one could use the lambda operator (Integral of TGraph)

TF1 f1("f",[&](double *x, double *){ return g.Eval(x[0]); },1,10,0); double integral = f1.Integral(1,10);
, but I’m also clueless about how to call like this from python (I guess giving the python lambda doesn’t work).