batmang
October 22, 2009, 10:44am
1
Hallo,
I wrote a class which uses ROOT libs and which I want to make a shared lib to use interactively in ROOT.
I compiled the class with
gcc -c -fPIC -pthread -m32 -I/usr/local/root/include Waveform.cpp
with no errors, and I create a shared lib with
gcc -shared -o libWaveform.so Waveform.o
which also gives no errors. The point is that when I try to load it with
gSystem->Load("libWaveform.so");
I get this:
dlopen error: libWaveform.so: undefined symbol: _ZN8TVectorTIdE4DrawEPKc
Load Error: Failed to load Dynamic link library libWaveform.so
Any suggestion what could it be?
Waveform.cpp (8.2 KB)
WaveformLinkDef.h (57 Bytes)
Waveform.h (1.77 KB)
Axel
October 22, 2009, 1:38pm
2
Hi,
your lib depends on libMatrix. You either need to load it before loading your library, or you need to tell the linker about the dependency: gcc -shared -o libWaveform.so Waveform.o -L$ROOTSYS/lib -lMatrix -lCore -lCint
Cheers, Axel.
batmang
October 23, 2009, 12:18pm
3
Hi Axel,
thanks a lot. Anyway if I do as you say i got no error when using gcc but I got this error when I tried to load the library:
root [0] gSystem->Load("libWaveform.so");
dlopen error: libWaveform.so: undefined symbol: _ZTV8Waveform
Load Error: Failed to load Dynamic link library libWaveform.so
*** Interpreter error recovered ***
Cheers,
Andrea
Finally I fixed the problem: I did’t implement the destructor.
Thanks again,
Andrea