I am trying to load a macro which is outside and would like to pass say a histogram object to it. How can I do it?
Main macro :
#include <TH1D.h>
using namespace std()
void testMacro(){
TH1D *h = new TH1D("h", "", 10, -3, 3);
h->FillRandom("gaus", 1000);
gROOT->ProcessLine(".L extMacro.C+")
extMacro(h); // Fails here
}
External Macro :
#include <TH1D.h>
#include <iostream>
void extMacro(TH1D *h){
std::cout << h->GetSize() << endl;
}
.L testMacro.C++ // Successful if the line extMacro(h) is commented out