Re:enum problems

From: Patrick Decowski (decowski@mit.edu)
Date: Fri Dec 11 1998 - 17:03:43 MET


hi masa,

thank you very much for your prompt answer. i would agree that this
would be a feature, but in that case it is a little inconsistent,
because a. the class definitions remain in memory (witness the class
TPhOrcl which was in the shared lib and which is still there after
gROOT->Reset()) and b. root complains if you do another gSystem->Load
after a gROOT->Reset() with a warning:

root [0] gSystem->Load("../lib/libOrcl.so");
root [1] gROOT->Reset()
root [2] gSystem->Load("../lib/libOrcl.so");
Warning: File
"/ralph2/users2/decowski/Phat/OraNew/macro/../lib/libOrcl.so" already loaded
root [3]      

i agree completely that the case you are describing is better. i was
only surprised at the inconsistency between treating classes and enums

regards,
patrick.

On Fri, 11 Dec 1998, Masaharu Goto wrote:

> 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.
> 
> 

-------------------------------------------o-------------------------------
Patrick Decowski                           |
24-504                                     |    Home:      (617)625-9352
Massachusetts Institute of Technology      |    Office:    (617)253-9735
77 Massachusetts Ave                       |    Fax:       (617)253-1755
Cambridge, MA 02139-4307                   |
-------------------------------------------o-------------------------------
http://web.mit.edu/decowski/www/home.html  |    e-mail: decowski@mit.edu
-------------------------------------------o-------------------------------



-------------------------------------------o-------------------------------
Patrick Decowski                           |
24-504                                     |    Home:      (617)625-9352
Massachusetts Institute of Technology      |    Office:    (617)253-9735
77 Massachusetts Ave                       |    Fax:       (617)253-1755
Cambridge, MA 02139-4307                   |
-------------------------------------------o-------------------------------
http://web.mit.edu/decowski/www/home.html  |    e-mail: decowski@mit.edu
-------------------------------------------o-------------------------------



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