Macro loading in root6

Hi everyone,

I’ve just installed ROOT 6.04/12 via binary (could not compile it manually on Mac OSX 10.11.2, some errors occurred). The problem is simple: if I change and save a macro’s source code while a ROOT session is open, ROOT seems not to recognize this update, and loads the macro in the older version. For example, if my macro writes a sentence on the screen and I change it after opening the ROOT session, the result of running the macro is displaying the original sentence.

Anyone else has this problem? Guess what can be?



This behavior was somewhat inadvertent and was not fully implemented (i.e. the changes you described, e.g. modifying a few line of code inside a function, was okay but if you have changed the list of data member in a class definition, random behavior will have resulted).

To do what you want, you now need to explicitly (unload and) reload the script. (i.e. redo a .L).


Thanks so much for your reply.
However, I tried to reload the macro with the .L command, and it does not change anything, ROOT continues to run the original version…


Indeed the unload is ineffective, we need to fix that. I recorded the problem at



That’s finally fixed in the master.

Cheers, Axel.


That’s finally fixed in the master.

Cheers, Axel.[/quote]

I am still having this problem with unloading the macro despite upgrading to new version of root.
They do not change when I change the file and do the load-unload procedure. Need to quit root and start it again.
The unnamed macros do not seem to have the same problem.
My versions are the following:
ROOT 6.06/08 (installed from binary)
MacOSX 10.11.6
Apple LLVM version 7.3.0 (clang-703.0.31)

Thanks in advance for any advice, Ania

Hi Ania,

Could you send a script that I can run that shows this problem?

Note that was I was referring to is ROOT not noticing that the file itself has changed, i.e. still keeping the old content in ROOT even though the file has changed on disk.

I believe what you are referring to is ROOT’s inability to reload some code - it does see the new file content, but it doesn’t manage to “understand” it correctly? That’s a known issue; I wish I had more time to tackle that…

Still - could you send some code reproducing this, so I understand what we are talking about here?

Cheers, Axel.

Hi Axel,

I don’t know if this is Ania’s problem, but unloading does not work properly for me. Minimal code to create a segfault:

template <typename T>
void boom() {
    auto innocentLambda = [](){};

void testUnload() {

To get the segfault, do:
.L testUnload.C
.U testUnload.C

Hi Axel,

Thanks for the reply.

The problem I experience is for example with the test macro1.c provided in the Root Primer.
After starting root, I run:
.L macro1.c
.U macro1.c

I change the file (for example different text on the graph, or different position of the data point) and save,
and then do again:
.L macro1.c
The results are the same even though the file on disk has changed.
I need to quit the root and start it again to see the modifications.
The same with executing the macro using .x macro1.c

If, on the other hand I modify this macro to the unnamed one i.e. just put commands in the brackets without
function declaration:

and run .x macro1.c, then modify the file and run again I can see the changes without having to quit and restart root.
So for the first scenario with the named macro the old program is still somewhere in memory and is executed
despite the saved changes in the file and the unloading-loading procedure.
What am I doing wrong? Naively, I would expect that after unloading the old version should be forgotten;
I am relatively new to the Root program and so just learning it.

I am using version 6.06/08, btw.



I still find the problems subject of this thread and reported as solved. When I use an unnamed macro, the second time I run it produces errors because all the variables are already defined.
gROOT->Reset(); apparently does no remove globals. Here is a minimal example
Int_t i=1;
the second execution with .x gives
/Users/pepe/Desktop/Radon Paper/macros/./test.C:4:11: error: redefinition of
Int_t i=1;
/Users/pepe/Desktop/Radon Paper/macros/./test.C:4:11: note: previous definition
is here
Int_t i=1;

This happens independently of using .x or .L and then .U

If on the other side I use a named macro say
void test(){gROOT->Reset(); Int_t i=1; cout<<i<<endl; }
there is no problem with redefinitions because they are not globals, but if I change i on disk, and save the file, ROOT does not see this change unless exiting and opening a new session.
Is there a point I am missing or it is a bug? This problem does not appear in ROOT5. I use ROOT6 on a macOSX running El Capitan, and the last version 6.06/08 installed from binaries.


1 Like

Hi Jose and Ana,

Sorry, I missed your posts - let’s hope the new forum helps with that…

Jose - that’s indeed an issue. I have created for it.

Ana - is this still an issue e.g. with ROOT 6.08? I thought we had fixed that. I’ll try it tomorrow and create a test if we don’t have one yet.


This post is two years old. Any time scale on when it will be fixed? For now the solution seems to be to only ever use named macros.