[vtk-developers] VTK CVS broken: vtkInformationExecutivePortVectorKey and vtkExecutive link error in Debug only

Brad King brad.king at kitware.com
Sat Oct 20 10:26:08 EDT 2007


Thompson, David C wrote:
> Brad et al.,
> 
>     I'm seeing some warnings on Windows about inconsistent
> DLL linkage. Right now vtkInformation looks like:
> 
> class VTK_COMMON_EXPORT vtkInformation : public vtkObject
> {
>   // ...
>   void MethodInCommon();
>   void MethodInFiltering();
> };
> 
> I'm not familiar with Windows import/export behavior. Should
> I change it to
> 
> class VTK_COMMON_EXPORT vtkInformation : public vtkObject
> {
>   // ...
>   void MethodInCommon();
>   VTK_FILTERING_EXPORT void MethodInFiltering();
> };
> 
> or
> 
> class vtkInformation : public vtkObject
> {
>   // ...
>   VTK_COMMON_EXPORT    void MethodInCommon();
>   VTK_FILTERING_EXPORT void MethodInFiltering();
> };
> 
> or something else entirely?

In general the latter would be necessary.  However we should be able to
hack around this for our case as follows.  Inside
Filtering/vtkInformation.cxx, write this:

#include "vtkObject.h"
... other includes here...but not vtkInformation.h
#ifdef __vtkInformation_h
# error "vtkInformation.h must not be included before this line."
#endif
#undef VTK_COMMON_EXPORT
#define VTK_COMMON_EXPORT VTK_FILTERING_EXPORT
#include "vtkInformation.h" // must be last #include
...rest of code...

This will hack the vtkInformation class to think it is exported from
Filtering when compiled inside that one source file.  That will cause
just those methods to be exported correctly.

-Brad



More information about the vtk-developers mailing list