Hi,
Since "test" is compiled, CINT can not know anything about local
variable. Instead you need to create a string containing the
information needed.
For example:
void test()
{
Double_t p = 100;
char params[256];
sprintf(params,"%d",p);
TMethodCall m("test_func", params);
if (!m.IsValid()) return;
m.Execute();
}
Cheers,
Philippe
-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Du, Yifei
Sent: Thursday, October 17, 2002 8:18 AM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] How to pass parameter into reflection function?
Hi,
I try to pass a parameter into a reflection function as following,
"test_func" is a global C function:
void test()
{
Double_t p = 100;
TMethodCall m("test_func", "p");
m.Execute();
}
Both "test" and "test_func" are compiled and linked. However, when I run it
CINT compains "p" is "not defined in current scope".
If I manually execute above 3 lines of "test" function in command line, then
everything's fine, I guess it is because then "p" is global.
So the question is how to pass local variable into a reflectoin function as
parameter in compiled env.
Thanks for any help
YF
<FONT SIZE =
1>**************************************************************************
**
This e-mail and any attachments may contain confidential and privileged
information. If you are not the intended recipient, please notify the sender
immediately by return e-mail, delete this e-mail and destroy any copies. Any
dissemination or use of this information by a person other than the intended
recipient is unauthorized and may be illegal. Unless otherwise stated,
opinions expressed in this e-mail are those of the author and are not
endorsed by the author's employer.</FONT>
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:14 MET