RE:problem with unloading an interpreted

Masaharu Goto (MXJ02154@niftyserve.or.jp)
Wed, 24 Jun 1998 20:45:00 +0900


Pasha,

ROOT/CINT behaves as it is supposed to. The command '.L file' executes
a sequence of

1) G__unloadfile("file");
2) G__loadfile("file");

This is convenient when you modify the "file" and try it many times.

>Error: G__unloadfile() Can not unload "cant_unload.C", file busy

This error happens in stage 1). G__unloadfile() tries to unload all files
that is loaded after "filename". Source file loading stack looks as follows
after you run test1.C

root[0] .x test1.C
root[1] .file
0 fp= xxxxxx lines=5 file="test1.C"
1 fp= xxxxxx lines=4 file="cant_unload.C"

Then you run test2.C. At the moment of test2.C start-up, source file loading
stack looks like

test1.C
cant_unload.C
test2.C

Then ".L cant_unload.C" is executed. This command tries to unload
cant_unload.C and test2.C. Because test2() is running, this causes error.

Masaharu Goto

---------------------------------------------------------------------------
Dear ROOT developers,

I guess I'm hitting a problem with unloading an interpreted script and here is

how it reveals itself (I boiled the real problem down to this example):

- I have 2 scripts - test1.C and test2.C, both trying to load the same
3rd script by calling TInterpreter::ProcessLine method:

--------------------------------------------------test1.C
int test1() {
gROOT->Reset();
gInterpreter->ProcessLine(".L cant_unload.C");
}
-------------------------------------------------- test2.C
int test2() {
gROOT->Reset();
gInterpreter->ProcessLine(".L cant_unload.C");
}
-------------------------------------------------- cant_unload.C
int cant_unload() {
cout << "cant unload" << endl;
}
---------------------------------------------------

- and here is the diagnostics (root 2.00/08 compiled on IRIX62/GCC):

------------------------------------------------------------------------------
--root [0] .x test1.C
(int)0
root [1] .x test2.C
Function test2() busy. loaded after "cant_unload.C"
Error: G__unloadfile() Can not unload "cant_unload.C", file busy
FILE:/data61/top/murat/lgammamet/test2.C LINE:3
(Int_t)0
*** Interpreter error recovered ***

In case I'm using G__loadfile() instead of calling TInterpreter::ProcessLine
things seem to be all right.

Regards, Pasha.