Gonzalo
September 1, 2023, 2:36pm
1
This is a dummy version of the problem (using ROOT version 6.24/09):
I would like to create a shared library (dummy.cc):
#ifdef SUM0
int sum0(int x){return x+0;}
#endif
int sum1(int x){return x+1;}
This can be done (see manual/root_macros_and_shared_libraries/) through a ROOT shell using the Load directive
root [0] .L dummy.cc++
Of course this only compiles the sum1 function as SUM0 is not defined.
Is it possible to activate the SUM0 block?
In fact it is but I am not sure if this is the expected behaviour…
root [0] gSystem->AddIncludePath("-DSUM0")
root [1] .L dummy.cc++
couet
September 1, 2023, 2:49pm
2
Welcome to the ROOT forum.
If the method you are using works why not using it ? May be have a look at CompileMacro , it seems that’s what you are looking for.
Gonzalo
September 1, 2023, 3:36pm
3
Thanks for the response.
Sure it works, but I would have expected AddIncludePath to be used to add only include paths, thus adding -I flag.
From the reference you are pointing out, I have also tryed
gSystem->SetMakeExe("g++ -Wall -fPIC $IncludePath $SourceFiles -o $ExeName $LinkedLibs -DSUM0")
but the -DSUM0 flags is not being obeyed.
Axel
September 5, 2023, 8:17am
4
Hi,
This is really for historical reasons - people used AddIncludePath()
to pass extra flags and now we have to support it
You want to use TSystem::SetMakeSharedLib()
not SetMakeExe()
.
Cheers, Axel
system
Closed
September 19, 2023, 8:17am
5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.