Hi,
I am trying to call a script from inside a compiled main (see below). I
have two questions.
1) calling LoadMacro rather than ProcerssLine(".L MyTest.C") doesnt seem
to work, I get errors like:
Error: Function my_start() is not defined in current scope
FILE:/tmp/CZEfNi_cint LINE:1
Possible candidates are...
filename line:size busy function type and name
*** Interpreter error recovered ***
Why is this?
2) I would like to call different scripts with the same functions. So I
need to "Unload" a macro so I can do something like:
gROOT->LoadMacro("script1.C+");
gROOT->ProcessLine("my_start()");
gROOT->UnloadMacro("script1.C")
gROOT->LoadMacro("script2.C+")
gROOT->ProcessLine("my_start()");
gROOT->UnloadMacro("script1.C")
How can I do this?
Caius
//========main
#include "TROOT.h"
#include <iostream>
using namespace std;
int main(void)
{
cout << "loadmacro"<<endl;
int error = 0;
gROOT->ProcessLine(".L MyTest.C++", &error);
if(error!=0){
cout <<"failed"<<endl;
return 0;
}
cout << "start"<<endl;
gROOT->ProcessLine("my_start();");
cout << "iter"<<endl;
for(int i=0; i<10; i++)
gROOT->ProcessLine("my_tick();");
gROOT->Reset();
gROOT->ProcessLine("my_tick();");
return 1;
}
//==script
#include <iostream>
int myi = 0;
using namespace std;
void my_start()
{
cout <<"start"<<endl;
return;
}
void my_tick()
{
cout <<"tick:"<<myi<<endl;
++myi;
return;
}
________________________________________
- CAIUS HOWCROFT -
- +44 (0)1223 764 128 UK(office) -
========================================
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:10 MET