Experimenting with running ROOT in embedded mode I ended up with the
following example
--------------------------------------------------------------------------------
#include "TROOT.h"
#include "TRint.h"
extern void InitGui();
VoidFuncPtr_t initfuncs[] = { InitGui, 0 };
int Error; // needed by Motif
TROOT root("Rint","The ROOT Interactive Interface", initfuncs);
main(int argc, char **argv) {
TRint* theApp = new TRint("example 1", &argc, argv, NULL, 0);
theApp->Run(kTRUE);
delete theApp;
theApp = new TRint("example 2", &argc, argv, NULL, 0);
theApp->Run(kTRUE);
delete theApp;
}
--------------------------------------------------------------------------------
which prototypes 2 subsequent calls to ROOT event loop. This example generates
diagnostics:
root [0] .q
root [1] Error in <TApplication::TApplication>: only one instance of TApplication allowed
The diagnostics is due to the fact that TRint::TRint(..) ctor does some nontrivial
actions including dynamic memory allocations and registering allocated pointers in
gSystem. The destructor for TRint class does however nothing:
--------------------------------------------------------- RINT_Rint.cxx
TRint::~TRint()
{
}
--------------------------------------------------------------------------------
so the second call to constructor interferes with the first one.
Is it a design feature or a place which should be fixed?
Thanks, Pasha
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:26:21 MET