Hello,
It is related to
but provided solution does not help me.
I have a macro (test_callmacro.C) that calls another macro (test_calledmacro.C), but the arguments are names of local variables and the return value is a pointer.
It used to work for Root 5.
With 6 it works providing I load the called macro test_calledmacro.C before executing the main one:
root [2] gROOT->LoadMacro("test_calledmacro.C");
root [3] .x test_callmacro.C
Is there any way to get it working in a batch mode?
///////////////////////////////////////////////// test_callmacro.C
Int_t test_callmacro() {
int retval = gROOT->LoadMacro("test_calledmacro.C");
if (retval != 0)
{
::Error("ExtractCRkeyObsPoints","loading test_calledmacro.C");
return 1;
}
int myarr[4] = {1,2,3,4};
Double_t* result = test_calledmacro(myarr,4);
for (int i=0; i<4; i++)
{
printf("%8.4f ",result[i]);
}
printf("\n");
return 0;
}
///////////////////////////////////////////////// test_calledmacro.C
#include <TError.h>
#include <TString.h>
Double_t* test_calledmacro( int* arrint, int size) {
Double_t* retval = 0x0;
if(size < 1) return retval;
retval = new Double_t[size];
for(int i=0; i< size; i++) retval[i] = arrint[i];
return retval;
}
/////////////////////////////////////////////////