Re: return value in CINT

From: OKUMURA, Akira <oxon_at_astro.isas.jaxa.jp>
Date: Wed, 25 May 2011 06:13:37 -0700


Hello Axel,

Thank you. It works perfect for Int_t, but can I get other types or classes?

Regards,

--
OKUMURA, Akira oxon@{astro.isas.jaxa.jp,stanford.edu}
Institute of Space and Astronautical Science (ISAS/JAXA)
Now at KIPAC/SLAC/Stanford
Varian Physics #306, 382 Via Pueblo Mall, MC 4060
Stanford, CA 94305-4060
TEL 650-736-0971/FAX 650-724-5065
Skype : okumura.akira

On 2011/05/25, at 5:49, Axel Naumann wrote:

> Hi Akira,
> 
> use
> 
> gROOT->LoadMacro("MyMacro.C++"); // this macro contains Int_t MyFunc()
> Int_t n = gInterpreter->ProcessLine("MyFunc()");
> 
> Cheers, Axel.
> 
> 
> OKUMURA, Akira wrote on 05/25/2011 04:52 AM:

>> Hello ROOTers,
>>
>> I would like to know if there is any way to get the return value of a function which is loaded via TROOT::LoadMacro in a compiled code.
>>
>> Below is my conceptual code to be compiled by g++.
>>
>> int main()
>> {
>> (snip)
>> gROOT->LoadMacro("MyMacro.C++"); // this macro contains Int_t MyFunc()
>> Int_t n = MyFunc(); // How can I do this?
>> (snip)
>> }
>>
>> I would like to use MyMacro.C as a configuration file of the main program. The algorithm inside MyFunc() changes in each MyMacro.C. For example,
>>
>> --- MyMacro1.C ---
>> Int_t MyFunc()
>> {
>> return 1;
>> }
>>
>> --- MyMacro2.C ---
>> Int_t MyFunc()
>> {
>> return 2;
>> }
>>
>> Regards,
>>
>> --
>> OKUMURA, Akira oxon@{astro.isas.jaxa.jp,stanford.edu}
>> Institute of Space and Astronautical Science (ISAS/JAXA)
>> Now at KIPAC/SLAC/Stanford
>> Varian Physics #306, 382 Via Pueblo Mall, MC 4060
>> Stanford, CA 94305-4060
>> TEL 650-736-0971/FAX 650-724-5065
>> Skype : okumura.akira
>>
>>
>>
>>
>> Regards,
>>
>> --
>> OKUMURA, Akira oxon@{astro.isas.jaxa.jp,stanford.edu}
>> Institute of Space and Astronautical Science (ISAS/JAXA)
>> Now at KIPAC/SLAC/Stanford
>> Varian Physics #306, 382 Via Pueblo Mall, MC 4060
>> Stanford, CA 94305-4060
>> TEL 650-736-0971/FAX 650-724-5065
>> Skype : okumura.akira
>>
>>
Received on Wed May 25 2011 - 15:16:06 CEST

This archive was generated by hypermail 2.2.0 : Wed May 25 2011 - 17:50:01 CEST