Problem to load dynamically a *.so library


I defined a class MPGDEvent and compiled it succesfully, creating the MPGDEventDict files and the library

I can execute a program reading data from a file, filling a tree with one branch consisting in MPGDEvent class, and saving the whole in a Root file, .

When opening a TBrowser window in a Root active session, I am able to see the contents of the tree.

But the problem comes when I tried to load the library by:

if(!TClassTable::GetDict(“MPGDEvent”)) {
gSystem->Load("$MPGDGASSI/rootobjects/") ;

I got the following error message:

dlopen error: /projet/micromegas/banclaser/dataanalysisgassiplex/rootobjects/ undefined symbol: _ZN9MPGDEvent6fGammeE
Load Error: Failed to load Dynamic link library /projet/micromegas/banclaser/dataanalysisgassiplex/rootobjects/

The fGamme was declared static in my MPGDEvent class. I initialized it in my reading data program.

When not using any static variable in my MPGDEvent class, after recompilation of the MPGDEvent class and my reading data program, everything works fine, including the dynamic loading !

What did I wrong ? Can anybody suggest me something in order to be able to use static variables in my class and load it dynamically in a Root session ?

Thanks a lot

If you have a class static variable (say double fgGamme) in your class definition file MPGDEvent.h, you must initialize it in your implementation file
MPGDEvent.cxx with

[code] double MPGDEvent::fgGamme=0; //or any other default value