Re: [ROOT] CINT - function pointers

From: Elias Athanasopoulos (
Date: Sun Sep 05 2004 - 14:13:30 MEST

Dear Wim,

Thank you for the reply.

On Sun, Sep 05, 2004 at 03:51:13PM -0700, wrote:
> >   func->SetArg((long)i);
> >   func->SetArg((long)j);
> >   func->SetArg((long)k);
> Based on the TF1 header file, the above should be double, double, long.

Actually you are right, but CINT seems to resolve correct the ctor, since
I added a call to G__CallFunc::GetPrototype() before calling the ctor and
I got:

elathan@velka:/opt/root> ./cf 
TF1 TF1::TF1(const char* name,void* fcn,Double_t xmin,Double_t xmax,Int_t npar)
Function:fcn cannot be compiled

I also performed the changes you suggested (I have attached the source) but 
without any success. It seems that this is a CINT bug or a CINT limitation
(or a big-time mistake of mine).

> Assuming that you're trying to get TF1 to work with ruby native functions:
> getting it to work with python functions was a little hellish. The current
> PyROOT implementation is by no means pretty to look at, but you would do
> yourself a favour to first look at pyroot/src/Pythonize.cxx (under the TF1
> behaviour block), since it does work.

Yes, this is what I am trying to do, but I have already done it before
in static ruby-root. The code is already in ROOT's CVS and I just want to
activate it.

At first, when I was thinking of a way to support this, I was puzzled and
one thought was to use CINT to create C functions at run-time; I think this
is, more or less, what you do in PyROOT. But I thought this was way to 
complex to implement and maintain.

Finally, I picked up a more elegant solution, IMHO, which does not use
CINT. I just maintain a table with ROOT function names and Ruby methods,
and I call the appropriate one using TF1::GetCurrent(). It's very easy to implement
and quite fast. You can have a look at: ruby/src/drr.cxx (rr_ctf1_fcn(),

But, in order to support this feature in my way, I need CINT to be able
to set correctly a function pointer to the argument list of G__CallFunc
instance; something that I can't figure out how is done.

Does anyone know if Masaharu Goto reads roottalk?

University of Athens			I bet the human brain 
Physics Department				is a kludge --Marvin Minsky 


This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:09 MET