Compile a macro without running?

Hello, I normally run my macros with a command like

which compiles the macro if the source has changed and then exectutes the function mymacro(parameter). Is there a way to separate the two actions, to compile separately without actually executing the macro? I know that from inside a root session I can do .L mymacro.C+, but what about from the command line outside of root?

Thanks.

1 Like

[url]Compile and run from command prompt
See also http://root.cern.ch/root/html/TROOT.html#TROOT:LoadMacro and http://root.cern.ch/root/html/TROOT.html#TROOT:Macro

Hi,

You can even compile it without loading the resulting shated library by calling ACLiC directly (gSystem->CompileMacro).

See for a complete example of a macro used to leverage ACLiC from a Makefile:
http://root.cern.ch/viewvc/trunk/scripts/build.C?view=markup&revision=1942&root=roottest

Cheers,
Philippe.

What do you actually try to say?

“Compile it with loading” can easily be achieved by:
gROOT->LoadMacro(“filename++”);

“Compile it with loading and executing” can easily be achieved by:
gROOT->Macro(“filename++(arg1, arg2)”);

Well, unless you wanted to say “compile it WITHOUT loading” … then one would really need:
gSystem->CompileMacro(“filename”, “kfc”);

BTW. What’s the difference between “.x filename” and “.X filename”?

Hi,

I meant without (i corrected the post).

In ROOT there is no difference between .x and .X (in standalone CINT one can handle only unnamed macro and the other only named macro).

Cheers,
Philippe