Re: [ROOT] Using dll in win32 application

From: Valeri Fine (fine@bnl.gov)
Date: Fri Aug 02 2002 - 15:07:50 MEST


Yes, you can.
But you should take care to link your code against of the so-called WIn32
"export" library.

Check %ROOTSYS%\test\MAkefile.win32
to see how this library can be created and used.

Hope this helps, Valeri

-----Original Message-----
From: Ed Oltman <eoltman@imago.com>
To: Roottalk@Pcroot. Cern. Ch <roottalk@pcroot.cern.ch>
Date: 1 августа 2002 г. 23:56
Subject: [ROOT] Using dll in win32 application


>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:03 MET