Hi,
I try to keep my code compatible for running it with aclic/cling/gcc. My example “funky.C” is attached.
for aclic
.L funky.C+
funky()
and with cling alone
.L funky.C
funky()
in simple macros
#include "TROOT.h"
#include "TInterpreter.h"
void macro() {
gInterpreter->LoadMacro("funky.C+");
gROOT->ProcessLine("funky();");
}
and with standalone compilation (key ingredient is “int main() { funky(); return 0; }”
CPPFLAGS=-Wall -Wextra
CC=g++
all: funky
funky: funky.o
clean:
rm -f funky funky.o
.PHONY: clean
Looking at the macro, you’ll see that i have a preprocessor #ifndef, which I use by changing between
make -W funky.C
and
make -W funky.C CPPFLAGS="-DLET_FUNK_OUT=1"
This is also handled correctly by cling
#define LET_FUNK_OUT
.L funky.C
funky()
and in macros
#include "TROOT.h"
#include "TInterpreter.h"
#define LET_FUNK_OUT
void macro() {
gInterpreter->LoadMacro("funky.C"); // NO + here
gROOT->ProcessLine("funky();");
}
Is there a way to tell the aclic compilation to set LET_FUNK_OUT in the way gcc handles -D options?
(looking for a solution which does not require editing funky.C, loading additional files however is within specs)
funky.C (198 Bytes)