Calling macros from compiled codes

Hi everybody,

 I need to call a macro, not compiled code, from a compiled code, a shared library which runs on CINT. This way, I would have some freedom in manipulating the code without having to recompile the library. Some time ago I posted exactly the same question on this forum and Philipe suggested to use the gROOT->ProccesLine() command then. Of course it worked, but it destabilizes the CINT so that it crashes from time to time, especially when I issue

a command which has to do with the canvas!!. I experience the same problem working with root 4 and root 3.10 as well.

any help is appreciated


Hi Masoud,

If all the code is well formed (i.e. only use object and pointer that are still valid, etc.), gROOT->ProcessLine should be destabilizing CINT.
In order for us to provide any more help, we would need a more precise description of the problem. For example you can send your code as well as the complete stack trace of the crash (obtain from running your example in the debugger).



Thanks for your answer.
Please find my code and the stack trace generated by the code in the attachment. This program reads in data from a socket and fills histograms. The program which writes data to a socket is not included here. I hope this is sufficient to track down the problem.

Thank you
monitor.tar.gz (227 KB)
StackTrace.txt (2.92 KB)


One important detail that you have not mentioned yet is that you are using threads. Both CINT and the GUI are not fully thread safe. It is recommended that all CINT commands and GUI execution be done in the same thread (which could be one for CINT, one for GUI).


Hi Philippe,

As you noticed I am using threads. Your recommendation, running everything on one thread, makes sense, but I can not
see how to run CINT and GUI things all on the same thread!
Do I need to hack into the root code or that there is a more straight forward way for this?

Thank you very much for your help