Add own class

Hi,

I tried to add my own data type class to root via a shared library. For this I used the following instructions:

http://www.phys.ufl.edu/LIGO/wavelet/root_shared_lib.html

Maybe I misunderstood them, I get this error when loading the lib in ROOT:

root [0] gSystem->Load("wavelet.so"); dlopen error: /home/ipefser1/kissel/Desktop/./wavelet.so: undefined symbol: __dso_handle Load Error: Failed to load Dynamic link library /home/ipefser1/kissel/Desktop/./wavelet.so *** Interpreter error recovered ***

My Code:

wavelet.cc

[code]#include “wavelet.h”

ClassImp(Wavelet)

Wavelet::Wavelet() {}
Wavelet::~Wavelet() {}
[/code]

wavelet.h

[code]#include “TObject.h”

class Wavelet : public TObject {

public:

Wavelet();
~Wavelet();

ClassDef(Wavelet, 1)

};
[/code]

I used these commands for compiling and linking:

g++ -fPIC -I ${ROOTSYS}/include wavelet.cc -o wavelet.o -c rootcint -f wave_dict.cc -c wavelet.h wavelet_LinkDef.h g++ -fPIC -I ${ROOTSYS}/include wave_dict.cc -o wave_dict.o -c ld -shared -o wavelet.so wavelet.o wave_dict.o

Then I tried this:

http://www.mail-archive.com/psyche-list@redhat.com/msg01716.html

But it doesn’t help. Any ideas? Thank you in advance :slight_smile:

Hi,

C++ .o files and shared lib are more complex than ld can handle. You must build the shared library using g++:g++ -shared -o wavelet.so wavelet.o wave_dict.o

Cheers,
Philippe