Re: [ROOT] reference to pointer sent by G__CallFunc

From: Jacek M. Holeczek (holeczek@us.edu.pl)
Date: Thu Mar 22 2001 - 15:12:17 MET


> I must admit I'm puzzled. Perhaps I didn't understand the cheating. Are
> you saying that passing X without casting to long does the trick ? as in
>     func.SetArg(X); (line 86 of TF77.cxx), X being a reference to a double
The trick I use is that I give the SetArg the VALUE of X (not "pointer",
nor "reference") but, in all cases CINT correctly delivers the
"reference" to the user's function (which actually is a "pointer"-value).
The only problem is that it delivers the reference (pointer) of the COPY
of VALUE which was created by the "func.SetArg(X)". You do NOT get the
reference (pointer) to the original variable X. That means that as long as
you need to GET the value of your variable, it's o.k., but if you need to
SET/MODIFY this value, this trick will NOT work (you will modify the
"COPY" of your variable X, the one that was created by "func.SetArg(X)").
You have NO access to the original variable X. If you care about it, you
need to use pointers instead of references in all places.
Jacek.



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:40 MET