Re: .so libs & reading objects from a TFile

Rene Brun (Rene.Brun@cern.ch)
Tue, 18 May 1999 16:11:34 +0000


Hi Jorg,
My guess is that your saved Canvas contains objects with classes
in your shared libs. You must dynamic link these classes before
importing the Canvas in memory.
Check that your classes are really available before importing
the canvas with for example
.class myClass

The version 2.22 of Root soon to be released will be able to read
objects from a file when a class is missing. In this case, Root
will skip this object.

Rene Brun

. Rieling wrote:
>
> -----BEGIN PGP SIGNED MESSAGE-----
>
> hi all,
>
> there are problems when i try to read an object from a root
> file if the read is performed from shared lib code.
>
> i tried to read a TCanvas from a successfully opened TFile tf
> with the following 3 code segments:
>
> 1.) TCanvas * c1 = (TCanvas *) tf->GetKey("canvas")->ReadObj();
> // works, but only when i loaded the cxx source.
> // segfaults when i loaded the rsp. .so library.
>
> 2.) TCanvas * c1 = (TCanvas *) tf->Get("canvas");
> // works, but only when i loaded the cxx source.
> // segfaults when i loaded the rsp. .so library.
>
> 3.) TCanvas * c1 = new TCanvas();
> c1->Read("canvas");
> // works, but only when i loaded the cxx source.
> // segfaults when i loaded the rsp. .so library.
>
> i'd be happy about ideas/suggestions/corrections.
> tia,
>
> j"org.
>
> PS. i have root-2.21.08 on linux-glibc.
> .so was created with
> g++ -c -O2 -fPIC -fno-rtti -fno-exceptions
> -I/usr/local/root/include bla.C -o bla.o
> g++ -c -O2 -fPIC -fno-rtti -fno-exceptions
> -I/usr/local/root/include bladict.C -o bladict.o
> g++ -Wl,-soname,libbla.so -shared bla.o bladict.o
> -o libbla.so
> and certainly loaded with
> gSystem->Load("libbla.so")
>
> __________________________________________________________________________
> dr. j. rieling / daimlerChrysler aerospace, orbital systems & operations
> fon +49 421 5395643 fax +49 421 5395127 joerg.rieling@ri.dasa.de
>
> -----BEGIN PGP SIGNATURE-----
> Version: PGPfreeware 5.0i for non-commercial use
> Charset: noconv
>
> iQCVAwUBN0FlNzj2v2S/jY1FAQHwkAP+MZoafDM6EVYLTHPZilM0hzHa3IzTqkgw
> vL9Dc0MAu1H+Rwi6UEK7Om0v2lfbygq7kK7lG8vHxDLBpabpYPoPgFWyPf+I9lTi
> IRopFmy490iko6pLOcvXuTk90I77k3XkPe6Y2kq4glUo0k4sybL+9B+Ubb/jTG9q
> VhDYv9cKLLk=
> =qj18
> -----END PGP SIGNATURE-----