Usually the global variables are declared as extern
in the header file to avoid ODR violation (if static variable definition is used in a header file). The GetClassSharedLibs
trick we do is only for entities defined in header files.
gROOT is a macro definition in TROOT.h:406
– that’s even trickier.
For finding the corresponding library of gROOT or gStyle we should mangle the name and really look in the object files of the libraries. We do not a reachable interface from the ROOT prompt.
If you are thinking how to give user support of errors of [cling interface function]
kind – we should be able to provide a hint when printing the error there.
Just for the completeness of this thread …
For (almost) all ROOT classes, somewhere in the middle of the ROOT “Class Reference” web pages, right before the “Inheritance diagram for ...:
” graph (right before the “Member, Constructor, ..., Documentation
” sections), one can find the information which “#include
” files are needed.
Starting with ROOT 6.12, at the bottom of these web pages, one can find the “Libraries for ...:
” graph, which shows the library to link and its dependencies.
For an example, see: “TFile
” Class Reference (needs “#include <TFile.h>
”, link against “libRIO
”)
BTW. For the available “CMake” targets, see: ls -al ${ROOTSYS}/cmake/ROOTConfig-targets*.cmake