[ROOT] static inline functions

From: Ingo Strauch (strauch@mail.desy.de)
Date: Tue Oct 17 2000 - 15:49:57 MEST


Hi rooters,

did anyone encounter the following problem (on Linux with gcc-2.95.2, ROOT
versions 2.25/00 and 2.25/03)?

In our OO project we have one package dealing with tracks and vertices which
creates a shared library libtracks.so ...

But linking with this library always fails because of undefines references:

../lib/libtracks.so: undefined reference to
`H1BackwardIronTrack::Class_Version(void)'
../lib/libtracks.so: undefined reference to
`H1BackwardIronTrack::DeclFileName(void)'
../lib/libtracks.so: undefined reference to
`H1ForwardIronTrack::Class_Version(void)'
../lib/libtracks.so: undefined reference to
`H1BarrelIronTrack::Class_Version(void)'
../lib/libtracks.so: undefined reference to
`H1ForwardIronTrack::DeclFileLine(void)'
../lib/libtracks.so: undefined reference to `H1ForwardIronTrack::IsA(void)
const'
../lib/libtracks.so: undefined reference to
`H1BarrelIronTrack::DeclFileName(void)'
../lib/libtracks.so: undefined reference to `H1BarrelIronTrack virtual table'

and so on. Three (out of 34) classes are affected (all inheriting from the
same class). The functions which are not seen are generated by the ClassDef
macro (the inlined ones). Of course ClassDef and ClassImp is used along the
whole chain from TObject to those classes.

g++ has a strange behaviour here. The code generated by the ClassDef macros
(in principle) is the same for all classes in the package, so I don't have the
smallest hint why the symbols for those functions are not created in three
cases whereas they are created in all 31 other cases... The only thing which
might make those three stand out ist that they are the deepest in our
inheritance hierarchy: they are on the fourth layer beneath TObject.

Trying to use '-fno-default-inline' as a compiler flag does not change
anything. The only thing I found out is to send the output of the preprocessor
to a file which I then change so that the functions are only declared in the
body of the class declaration, but the actual implementation is outside (i.e.
no inlining).

Any hints??!

Cheers,
Ingo

----------------------------------------------------------------------------
Ingo Strauch       Budapester Str. 30, 20359 Hamburg, Tel.: +49 40 7421 4722
----------------------------------------------------------------------------
DESY, Group H1/AAC1, Room 1c354      | I.Phys.Inst. RWTH Aachen, Room 28B210
Notkestr. 85, 22607 Hamburg          |       Sommerfeldstr. 14, 52056 Aachen
Tel: +49 40 8998-2312 / Fax: -4385   |  Tel: +49 241 80-7183 / Fax: 8888-661
strauch@mail.desy.de                 |   strauch@toots.physik.rwth-aachen.de
----------------------------------------------------------------------------
http://www-h1.desy.de/~strauch/        or        http://come.to/Ingo.Strauch
----------------------------------------------------------------------------



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:35 MET