For each analysis I have a separate _rootexec.C which I execute from the terminal with
$ root mytry_rootexec.C
The problem in ROOT6 is that way rootexec.C does not run because the class is not known in advance, which as I understood was not needed in ROOT5. I tried using .rootmap and LinkDef.h files but I didn’t really understood how to use/generate them the right way.
How would I get this simple example to work?
Thanks
Sebastian
the reason is that in ROOT6, the interpreter is not a simple C++ “parser” but rather a veritable compiler.
The code of the macros is “seen” by the interpreter as a whole and not digested line by line. It is therefore not possible to make symbols known at runtime with processLine or loading libraries.
But don’t worry, there are at least two ways to achieve what you want:
Include the class code in your macro. Here the example crafted starting from your files: mytry_rootexec.C
The second suggestion works perfectly for me! In the end this is what I tried to accomplish. However I didn’t include the _rflx.cpp when compiling the library so it wouldn’t run.
glad it works. Indeed the second option is the cleaner one. In some sense I still find the first one interesting as it shows it’s possible to interactively use custom C++ classes in macros and at the ROOT prompt.