Macro in another macro

Is there a modern way to run a macro from another macro? The search results that come up for this are emails from 2001 and 2003, so I’m hoping there’s a better way now.
The problem with gROOT->ProcessLine(“macro”); is that if I try to pass parameters into the inner macro that were declared in C, root doesn’t recognize them.

ROOT Version: 6.18/04
Platform: Windows
Compiler: Not Provided


I guess this is related to the post you did about axis. Answer the other one with some code and I will see what is wrong.

what kind of parameter do you want to pass ?

I will try to explain it clearly, as it is a little bit complicated.
You gave me a macro to use called GraphDoubleString.C, which took two parameters, a graph and an array of strings.
If I made a graph and an array on the root command line, and then called

.x GraphDoubleString.C(gr,colour)

I would have no problem. Everything would work as intended. However, if I instead created the double and array in C++, and then tried to call
gROOT->ProcessLine(“.x GraphDoubleString.C(gr,colour);"),
root will not know what gr and colour are for whatever reason.
So I’m wondering, is there an alternative way to call macros from C++ that would allow the passing of C++ variables?

Yes it is tricky. See an example here:
https://root.cern/doc/master/THistPainter_8cxx_source.html#l03376