RE:enum problem

From: Masaharu Goto (MXJ02154@nifty.ne.jp)
Date: Fri Dec 11 1998 - 12:33:31 MET


Patrick,

I think this is rather a feature. gSystem->Reset() rewinds system back to 
the original state. So, unless you do gSystem->Load() again, you an not refer
to the symbols of the shared library. 

Let me explain why this is a feature. Suppose you have another library which
has same symbol name but different meaning. In order to switch those 2 libs
without stopping the process, you need to unload every definition in the 
shared library. 

Masaharu Goto

----------------------------------------------------------------
i am having a little bit of a problem with the following. it seems
that the values in an enum get reset after a gROOT->Reset() when the
shared lib got brought in with gSystem->Load(), but everything is fine
when the shared lib is linked together with the rootlibs into a
standalone executable. let me clarify:

i am compiling some classes into a shared lib, somewhere in the
header files i define an enum:

---TPhOrcl.h---
...
enum EDbStorageSize{
  kOraBatchSize = 10,
  kOraDateSize = 12,
  kOraTimeSize = 10
  ... 
};

class TPhOrcl : public TObject {
...
};
... 

in the LinkDef.h file i include it in:

---LinkDef.h----
...
#pragma link C++ class TPhOrcl;

#pragma link C++ enum EDbStorageSize;
...

everything compiles fine into a shared lib called libOrcl.so. i start
up root and do the following:

root [0] gSystem->Load("../lib/libOrcl.so");
root [1] .g kOraBatchSize
0x140731660 const EDbStorageSize kOraBatchSize=10
root [2] .g kCanDelete              // defined in an enum in TObject.h
0x1406161c0 const EObjBits kCanDelete=1
root [3] .class TPhOrcl
... // many lines
root [4] gROOT->Reset()
root [5] .g kCanDelete 
0x1406161c0 const EObjBits kCanDelete=1
root [6] .g kOraBatchSize
Variable kOraBatchSize not found
root [7] .class TPhOrcl
... // many lines
root [8]

once again, all is ok when i link libOrcl.so together with the
rootlibs into a standalone program. why are shared libs brought in
dynamically treated differently?

running 2.00/13 on OSF1 w/ cxx.



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:40 MET