Re: return value in CINT

From: Axel Naumann <Axel.Naumann_at_cern.ch>
Date: Wed, 25 May 2011 14:49:51 +0200


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 - 14:50:00 CEST

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