RE: [ROOT] compiling own libraries

From: Philippe Canal (pcanal@fnal.gov)
Date: Sat Dec 28 2002 - 05:22:14 MET


Hi,

When using C++, it is essential to link the library and executable using
'g++' rather than 'ld'.  The linking of C++ object files involves more that
just assembling the needed files into one library.  It also (at least) needs
to setup the initialization of global variables, etc. (this happens to be
essential to a ROOT/CINT dictionary).

Hence the solution is to do
  g++ -o libTTest.so -shared TTest.o TTestDict.o

Cheers,
Philipp
-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Eugen Wintersberger
Sent: Friday, December 27, 2002 12:04 PM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] compiling own libraries


Hello Routers
To become familiar with the process of integrating external libraries
into ROOT I wrote some useless code for testing purposes (TTest.h,
TTest.C and TTest_LinkDef.h in the attachment).
I generated the dictionary files with :

   rootcint -f TTestDict.C -c TTest.h TTest_LinkDef.h

and compiled and linked everything with

g++ -fPIC -I/include -o TTestDict.o TTestDict.C -c
g++ -fPIC -I/include -o TTest.o TTest.C -c
ld -soname,libTTest.so -o libTTest.so -shared TTest.o TTestDict.o

After that LibTTest.so can be loaded by ROOT with

  gSystem->Load("libTTest.so")

The problem is that a

  .class TTest

causes the following error message

root [1] .class TTest
Error: class,struct,union or type TTest not defined  FILE: LINE:0
*** Interpreter error recovered ***

which I don't understand.
ROOT version is:  3.04/02
and my compiler is gcc 2.95.4 on a Debian Linux 3.0r1.
I hope that anyone of you can help me.

  eugen



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:24 MET