Loading of a shared library compiled with c++


I would like to know how to do automatic loading of all linked ROOT libraries when loading an user library. This is not a problem in case this last one is compiled by ACLiC. But if I compile with c++ and later try to load it I need to load all other ROOT libs manually on which my lib has dependencies. Here is my example class header:
#ifndef TVECTORDEXT_H #define TVECTORDEXT_H #include <TNamed.h> #include <TTree.h> class TVectorDExt : public TNamed { public: TVectorDExt(); ~TVectorDExt(); TTree m_TTree; ClassDef(TVectorDExt, 1); }; #endif

And its cxx -file:

#include <TVectorDExt.h> ClassImp(TVectorDExt); TVectorDExt::TVectorDExt() { } TVectorDExt::~TVectorDExt() { }

If I make and load a shared lib from this class with ACLiC, then I can created a TVectorDExt object since the libTree.so is already loaded. But if I make a shared lib with c++, then it’s not enough to load (using gSystem->Load()) only libTVectorDExt.so in order to create a TVectorDExt type object. Rather I need to load libTree.so manually before and then it works. I found this quite inconvenient, especially if my class has much more dependencies rather than in the simple case above. Is it possible to do this like ACLiC does? So, to force ROOT automatically define all necessary libs and load them. Thanks much in advance.

Cheers, Gia


You will need to either link your library against the depend library or create a rootmap file. For example with:rlibmap -o mylibrary.rootmap -l mylibrary.so -d libGraf.so libHist.so libTree.so libRIO.so -c mylinkdef.h