Hi, I am having a really strange problem, hopefully there is an easy fix. I am using header files to define some constants. Using gROOT->Reset() clears the defines, but then ROOT still thinks the file is loaded. So the second time I run the script, the defines are not set.
Here is an example of what I mean. I have two files:
root [1] .x main.cxx
Note: File "header.hxx" already loaded
Error: Symbol _EXAMPLEDEFINE is not defined in current scope main.cxx:4:
Error: << Illegal operator for pointer 3 main.cxx:4:
!!!Dictionary position not recovered because G__unloadfile() is used in a macro!!!
*** Interpreter error recovered ***
I can only run it again by exiting and reopening ROOT.
What can I do to tell ROOT it needs to reload the include file?
Note how the gROOT->Reset() is gone and how the #include moves outside the function - it’s proper C++. Does that solve the issue? It should, we use CINT this way every day
The problem is aall variables and objects go out of scope and can’t be used after script is done executing. They do for unnamed scripts. Is there a way to keep them for named scripts?
It still seems like there should be a way to do this for unnamed scripts anyway. I would think gROOT->Reset() should also clear all header files out of memory and allow them to be loaded again.
[quote]The problem is aall variables and objects go out of scope and can’t be used after script is done executing. They do for unnamed scripts. Is there a way to keep them for named scripts?[/quote]You can declare some of the variables in the global scope ; this way this will no go out of scope at the end of the routine.