[vtkusers] inconsistent dll linkage
Leonardo Soto M.
leonardosoto at udec.cl
Fri Sep 23 16:23:50 EDT 2005
David,
You are right. I was using the next class definition:
class VTK_RENDERING_EXPORT ObjectInteractorStyle : public vtkInteractorStyle
Now I defined the macro shown below and it works!
#define OBJECT_INTERACTOR_STYLE_EXPORT __declspec( dllexport )
class OBJECT_INTERACTOR_STYLE_EXPORT ObjectInteractorStyle : public
vtkInteractorStyle
Thanks for your help!
Leonardo
----- Original Message -----
From: "David Cole" <david.cole at kitware.com>
To: "Leonardo Soto M." <leonardosoto at udec.cl>
Cc: <vtkusers at vtk.org>
Sent: Friday, September 23, 2005 12:09 PM
Subject: Re: [vtkusers] inconsistent dll linkage
> I'm gonna guess that your class declaration in your header file looks like
> this:
> class VTK_RENDERING_EXPORT ObjectInteractorStyle : public
> vtkInteractorStyle
>
> The problem is that VTK_RENDERING_EXPORT only works for classes that are
> built into vtkRendering.dll. (This is controlled by the definition of
> vtkRendering_EXPORTS.)
>
> You need to define your own similar macro that resolves to
> __declspec(dllexport) when being built into your dll,
> __declspec(dllimport) when being consumed by a client outside your dll and
> nothing when built on a non-Windows system or when built with static lib
> linkage.
>
> You can use a similar technique to that found in Common/vtkWin32Header.h
> using your own lib name in place of vtkRendering. i.e., if your lib is
> named MyLib, you'd test for MyLib_EXPORTS which is defined automatically
> for you by CMake when building your library as shared on Windows.
>
>
> Hope this helps,
> David
>
More information about the vtkusers
mailing list