Re: [ROOT] statics and Windows, was: TDatabasePDG::Instance()

From: Valeri Fine (fine@bnl.gov)
Date: Thu May 17 2001 - 01:47:21 MEST


To access the global variable under Windows that must be EXPORTED properly
The computer rebooting doesn't help.

  Valeri


----- Original Message ----- 
From: "Axel Naumann" <axel@fnal.gov>
To: "Pasha Murat (630)840-8237@169G" <murat@ncdf41.fnal.gov>
Cc: "Roottalk@Pcroot. Cern. Ch" <roottalk@pcroot.cern.ch>
Sent: Wednesday, May 16, 2001 7:13 PM
Subject: RE: [ROOT] statics and Windows, was: TDatabasePDG::Instance()


> Hi,
> 
> it's in there (I checked with dumpbin), but it won't come out. I am a bit
> puzzled because
> a) usually stuff like that should not happen,
> b) aparently it only happens on Win,
> c) I can't find a corresponding entry in the long list of MSVC compiler
> bugs,
> d) for some reason this does not happen to the root team building the
> windows root binaries,
> e) I have had root problems which often seem to be related to static
> globals, too. Examples:
> * static globals which were supposed to initialize the dictionary were not
> called,
> * trying to build root in Win2k myself does not work as the dictionary
> doesn't add classes that were gSystem->LoadClass'ed (I'd guess it's a
> problem with dlls and their statics),
> * and now this guy.
> 
> I'm afraid that ignoring messages like
> ---
> build/win/cxx.sh -Z7 -G5 -GR -MD -DWIN32 -D_WINDOWS -DWINVER=0x0400 -nologo 
> -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -D_X86_=1 -D_DLL -DVISUAL_CPLUSPLUS -Iincl
> ude  -o base/src/TApplication.o -c base/src/TApplication.cxx
> TApplication.cxx
> base/src/TApplication.cxx(49) : warning C4273: 'gApplication' : inconsistent
> dll linkage.  dllexport assumed.
> ---
> LINK : warning LNK4049: locally defined symbol ""class TInterpreter *
> gInterpreter" (?gInterpreter@@3PAVTInterpreter@@A)" imported
> ---
> HelpText.o : warning LNK4197: export "?gHelpObjects@@3QBDB" specified
> multiple times; using first specification
> ---
> during the built of root takes its revenge here...
> 
> We can reproduce these problems on different computers and by different
> people here at Fermilab, so it's hopefully not my stupidity or compiler
> version.
> 
> Ideas? Maybe I should just deinstall Win and get Linux...
> 
> Cheers, Axel.
> 
> > -----Original Message-----
> > From: murat@smtp.fnal.gov [mailto:murat@smtp.fnal.gov]On Behalf
> > Of Pasha Murat (630)840-8237@169G
> > Sent: Wednesday, May 16, 2001 5:15 PM
> > To: Axel Naumann
> > Cc: Roottalk@Pcroot. Cern. Ch
> > Subject: Re: [ROOT] TDatabasePDG::Instance()
> >
> >
> > Axel: I couldn't reproduce your problem on Linux - here your example
> > builds just fine. TDatabasePDG::fgInstance should be resolved by libEG -
> > you may double check if it is true in your case by using windows
> > equivalent
> > of UNIX `nm'.
> > best, Pasha
> > Axel Naumann wrote:
> > >
> > > Hi,
> > >
> > > I'm linking root against this main:
> > >
> > > #include "TROOT.h"
> > > #include "TDatabasePDG.h"
> > > int main(int argc, char* argv[]){
> > >     TROOT gRoot("globRoot","global Root");
> > >     TDatabasePDG::Instance();
> > >     return 0;
> > > }
> > >
> > > and the linker complains about
> > > teststuff.obj : error LNK2001: unresolved external symbol
> > "protected: static
> > > class TDatabasePDG *  TDatabasePDG::fgInstance"
> > > (?fgInstance@TDatabasePDG@@1PAV1@A)
> > > Release/teststuff.exe : fatal error LNK1120: 1 unresolved externals
> > >
> > > The link line is "libCore.lib libEG.lib". I'm using MS VC++ 6,
> > Win 2000; it
> > > happens with both Root 3.00/06 and Root 3.01/00.
> > >
> > > Any ideas about what's going on here?
> > >
> > > Cheers, Axel.
> >
> 
> 



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