> Valeri, > > I could not export a global. Here's what happened Have you created the RootCint dictionary for your class and defined your global variable with Linkdef.h pragma file ? #pragma link C++ global gApplication; replace "gApplication" with your global variable name. I guess your troubutes has nothing to do with VC++ rather with RootCint dictionary One has to create to access the class from the Root/Cint macro. %ROOTSYS%/test/Makefile.win32 contains an example of building the dictionary for "Event" class. However this example doesn't show the "gobal variable case" Valeri . > > I added > > R__EXTERN CAnalysis *gAnalysis > > to a class header file (outside the class definition!) and > CAnalysis *gAnalysis; > > to the implementation file. When I built using a makefile based on the > %ROOTSYS%\test\makefile.win32 I got the warning message: > > warning C4273: 'gAnalysis" : inconsistent dll linkage. dllexport assumed. > > The problem is that the variable is not global! when I try to use it from > within a root session, I get > > Error: Symbol gAnalysis is not defined in current scope > > (this is after loading the DLL that contains R__EXTERN.. Here's my > compile switches for file: > > > > > > cl -D_MT -D_DLL -MDd -nologo -G5 -GR -MD -DWIN32 -DVISUAL_CPLUSPLUS -D_ > WINDOWS -Ic:\root/include -O2 -c CManage.cpp > Command line warning D4025 : overriding '/MDd' with '/MD' > CManage.cpp > > > > > > > > Hi, > > How do I export a global variable from a DLL? I am using VC++6 on Win32 > > with root v3.02/07. Thanks. > > You should use cpp macro: R__EXTRERN > > YourClassHeaderFile.h: > R__EXTERN MyClassGolbalVariable *gMyGlobal; > > > Look up %ROOTSYS%/include/*.h file for the concrete examples examples > (See attachment as well) > > Hope this helps. Valeri > > > > > Ed Oltman > > > > > > >
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:53 MET