RE: [ROOT] root(cint) and template

From: Jacek M. Holeczek (holeczek@us.edu.pl)
Date: Fri May 11 2001 - 18:55:49 MEST


Hi,
Something got shorted in my mind ... and I can't recall how to make my
nice "template <class _FLT> class Complex" visible in ROOT (from a shared
library). I don't want to inherit from TObject, nor to use ClassDefT(2) as
they both add private data members.
So, how should the LinkDef look like ?
Thanks in advance,
Jacek.
P.S. Anyhow, I tried to inherit from TObject and use ClassDefT(2) and I got :
-----------------------------------------------------------------------------
[GSL]$ g++ -g -O2 -fPIC -DD -DALL -DROOT -I$ROOTSYS/include -c Cinst.cxx -o DComplex.o
[GSL]$ g++ -g -O2 -fPIC -DF -DALL -DROOT -I$ROOTSYS/include -c Cinst.cxx -o FComplex.o
[GSL]$ g++ -g -O2 -fPIC -DLD -DALL -DROOT -I$ROOTSYS/include -c Cinst.cxx -o LDComplex.o
[GSL]$ rootcint -f G__Complex.cxx -DROOT Complex ComplexLinkDef.h
[GSL]$ g++ -g -O2 -fPIC -DROOT -I$ROOTSYS/include -c G__Complex.cxx 
[GSL]$ g++ -g -O2 -fPIC -DROOT -I$ROOTSYS/include -shared -o Complex.so FComplex.o DComplex.o G__Complex.o
[GSL]$ root
  *******************************************
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   3.00/06     12 March 2001   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *          http://root.cern.ch            *
  *                                         *
  *******************************************

FreeType Engine v1.x used to render TrueType fonts.
Compiled with thread support.

CINT/ROOT C/C++ Interpreter version 5.14.79, Feb 24 2001
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] .L ./Complex.so
dlopen error: /.automount/p2a00/root/h/holeczek/src/root/GSL/././Complex.so: undefined symbol: __vt_t7Complex1Zr
Load Error: Failed to load Dynamic link library /.automount/p2a00/root/h/holeczek/src/root/GSL/././Complex.so
*** Interpreter error recovered ***
root [1] .q
-----------------------------------------------------------------------------
The ComplexLinkDef.h was just :
-----------------------------------------------------------------------------
#ifdef __CINT__
#pragma link off all typedefs;
#pragma link off all globals;
#pragma link off all functions;
#pragma link off all classes;

#pragma link C++ class Complex<float>;
#pragma link C++ class Complex<double>;
#if 0 // CINT error in sizeof(long double)
#pragma link C++ class Complex<long double>;
#endif

#endif
-----------------------------------------------------------------------------



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