problem with shared libraries

Alexander Zvyagin (zvyagin@mx.ihep.su)
Thu, 05 Feb 1998 21:25:14 GMT+03:00


IHEP, Protvino, Russia, 5-FEB-1998

Dear all,

I have next files: F1.h F1.c F2.h F2.c LinkDef.h
-----------------------------------------
// F1.h
#ifndef F1__include
#define F1__include
#include "TObject.h"
class F1 : public TObject
{
public:
F1(void) {}
ClassDef(F1,1)
};
#endif // F1__include
------------------------------------------
// F1.c
#include "F1.h"
ClassImp(F1)
------------------------------------------
// F2.h
#ifndef F2__include
#define F2__include
#include "TObject.h"
class F2 : public TObject
{
public:
UInt_t a;
F2(void) {}
ClassDef(F2,1)
};
#endif // F2__include
------------------------------------------
// F2.c
#include "F2.h"
ClassImp(F2)
------------------------------------------
// LinkDef.h
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class F1;
#pragma link C++ class F2;
#endif
-----------------------------------------
Very simple files.

Then i do:
=======================================================
rootcint -f F1_Cint.cxx -c F1.h LinkDef.h
rootcint -f F2_Cint.cxx -c F2.h LinkDef.h

g++ -O -fPIC -I /usr/local/root/include -c F1.c -o F1.o
g++ -O -fPIC -I /usr/local/root/include -c F2.c -o F2.o

g++ -O -fPIC -I /usr/local/root/include -c F1_Cint.cxx -o F1_Cint.o
g++ -O -fPIC -I /usr/local/root/include -c F2_Cint.cxx -o F2_Cint.o

g++ -O -shared F1.o F1_Cint.o -o ./F1.so
g++ -O -shared F2.o F2_Cint.o -o ./F2.so

root
*******************************************
* *
* W E L C O M E to R O O T *
* *
* Version 1.03/09 16 December 1997 *
* *
* You are welcome to visit our Web site *
* http://root.cern.ch *
* *
*******************************************

CINT/ROOT C/C++ Interpreter version 5.13.36, Nov 30 1997
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] .L F1.so
root [1] printf("%d\n",sizeof(F1));
12
root [2] .L F2.so
root [3] printf("%d\n",sizeof(F2));
16
root [4] printf("%d\n",sizeof(F1));
0
=======================================================

Why after loading F2.so sizeof(F1)==0 ?

OS: Linux 2.1.76 and 2.0.32

All files (+makefile) are in
http://gams.ihep.su/~zvyagin/home/ALICE/work/gen_SHAKER/test/

Thanks in advance,
Alexander.