RE:Re: [ROOT] making of libraries

From: Masaharu Goto (MXJ02154@nifty.ne.jp)
Date: Thu Mar 08 2001 - 13:54:44 MET


Hello Markus,

I need to make a correction to Fons's comment.

In fact, what Markus have done is almost correct.
I guess the problems was that you did not compile
and link definition of member function when making
shared library. Probably, you linked only dictionary
files. 

  $ rootcint -f Teq_clientDict.cxx -c eq_client.h LinkDef.h
  $ g++ -fPIC -c -I$ROOTSYS/include eq_clientDict.cxx
  $ g++ -shared -I$ROOTSYS/include -o eq_client.so eq_clientDict.o

You need to add TScreen.cxx also.

  $ g++ -fPIC -c -I$ROOTSYS/include eq_client.cxx
  $ g++ -shared -I$ROOTSYS/inclue -o eq_client.so eq_clientDict.o eq_client.o

Note that compiler options shown above may not be correct. I simply tried
to show you a concept.  You may also want to give definition of EqData to 
rootcint.

Thank you
Masaharu Goto


>Date: Wed, 07 Mar 2001 16:31:51 +0000
>From: Fons Rademakers <Fons.Rademakers@cern.ch>
>To: Markus Huening <mhuening@sun52a.desy.de>
>Cc: roottalk@pcroot.cern.ch, Masaharu Goto <MXJ02154@niftyserve.or.jp>
>Subject: Re: [ROOT] making of libraries
>
>Hi Markus,
>
>  you can not fake a complete classes. CINT needs to know the correct
>sizes when creating EqAdr and EqData objects grabber and grab.
>
>It will work if you make grabber and grab pointers to EqAdr and EqData.
>In that case you have only to provide simple forward declarations.
>
>#if !defined(__CINT__)
>
>#include <eq_client.h>
>#include "/usr/ttfsvr2/doocs/lib/include/eq_client.h"
>
>#else
>
>class EqAdr;
>class EqData;
>
>#endif
>
>
>Cheers, Fons.
>
>
>
>Markus Huening wrote:
>> 
>> Hallo everybody,
>> 
>> I have some problem when I try to include some external library into my
>> own to make it executeable with CINT. I couldn't read it directly with
>> rootcint so I tried some workaround which I found in the FAQs:
>> ...
>> 
>> #if !defined(__CINT__)
>> 
>> #include <eq_client.h>
>> #include "/usr/ttfsvr2/doocs/lib/include/eq_client.h"
>> 
>> #else
>> 
>> class EqAdr;
>>   {
>>   public:
>>   EqAdr();
>>   ~EqAdr();
>>   void adr(char*);
>>   };
>> class EqData;
>> class EqCall
>>     {
>>     public:
>>     EqCall();
>>     ~EqCall();
>>     EqData set(EqAdr*, EqData*);
>>     };
>> 
>> #endif
>> */
>> 
>> class TScreen : public TH2S
>>  {
>> private:
>>    EqAdr        grabber;
>>    EqData       grab;
>>    EqData       *dcsresult;
>>    EqCall       *dcscall;
>> 
>> ...
>> 
>> This works in compiled programs and I can load the library
>> (gSystem->Load) into the CINT. But as soon as I start the constructor of
>> TScreen (which also initialises grabber, grab, dcsresult & dcscall),
>> the interpreter is aborted with the error message
>> ...
>> root [1] fImg=TScreen("fImg","Picture from Viewscreen",640,256);
>> ld.so.1: /home/rasmus/Root/ROOT/bin/root.exe: fatal: relocation error:
>> file /home/mhuening/root/own/libTScreen.so: symbol __0oFEqAdrctv:
>> referenced symbol not found
>> ...
>> 
>> What did I do wrong?
>> 
>> Greetings
>> 
>> Markus Huening
>> ======================================================
>> Markus Huening
>> Desy/FDET
>> Notkestrasse 85
>> D-22607 Hamburg
>> Germany
>> 
>> Tel:    ++49 (040)8998-3030
>> Fax:    ++49 (040)8998-3094
>> e-mail: markus.huening@desy.de
>
>-- 
>Org:    CERN, European Laboratory for Particle Physics.
>Mail:   1211 Geneve 23, Switzerland
>E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
>WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:39 MET