Hi Ed, On Windows, one cannot access global variables between two DLLs. You should implement a class member function in your CAnalysis class returning the global variable. Rene Brun On Thu, 1 Aug 2002, Ed Oltman wrote: > Hello, > > I have been using a win32 dll that I created using rootcint + > compiler/linker. I have been using this dll from within root for some time > now (root 3.02/07, VC++ 6.0 on win2K) - everything works fine. Here's my > question: Is it possible to use this same dll from a stand-alone win32 > program? > > I've tried the following: > > I added the .lib file that VC++ when I built my dll to my new stand-alonge > project. The DLL exports a global variable: > > R__EXTERN CAnalysis *gAn; > > and I have this same line in my stand-alone program. I get the following > linker errror: > > > Summary.obj : error LNK2001: unresolved external symbol "public: __thiscall > CAnalysis::CAnalysis(void)" (??0CAnalysis@@QAE@XZ) > > > Note 1: when I use rootcint, I use a linkdef.h file that contains > > #ifdef __CINT__ > #pragma link off all globals; > #pragma link off all classes; > #pragma link off all functions; > #pragma link C++ class CManage; > #pragma link C++ class CAnalysis-; > . > . > . > #pragma link C++ global gAn; > #endif > > Note 2: In my DLL project, I have a class CManage which contains > > CAnalysis *gAn > > in the implementaion file and > > R__EXTERN CAnalysis *gAn; > > in the .h file. When I build the DLL, I get the warning message: > > LINK : warning LNK4049: locally defined symbol ""class CAnalysis * gAn" > (?gAn@@3PAVCAnalysis@@A)" imported > > perhaps this is a hint... > > Thanks, > > Ed Oltman > >
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:02 MET