[vtkusers] Using static VTK library in a DLL

Xavi Planes Xavier.Planes at upf.edu
Mon Nov 12 06:50:54 EST 2007


Hi,

 

I'm using VTK libraries, for compiling and linking my own code. I use a DLL
library and an application program to test it. The application program does
this:

1. Loads a vtkPolyData using vtkPolyDataReader.

2. Calls the function SetData(vtkPolyData *pData ) on an object inside the
DLL. The pData pointer is copied into an internal pointer m_pData and calls
Register( ) function of the pData.

3. Destroy the vtkPolyDataReader: ptrVtkReader->Delete();

4. Call function Initialize() of the object inside the DLL. This function
uses the vtkPolyData stored into the internal pointer m_pData, creates a
vtkThreshold filter, calls SetInput() and calls Update().

 

If I use VTK libraries compiled in dynamic mode, there's no problem and
everything is working fine. 

However, if I use VTK libraries compiled in static mode, the vtkThreshold
raises this error:

"vtkStreamDemandDrivenPipeline: Input for connection index 0 on input port
index 0 for algorithm vtkThreshold is NULL, but a vtkDataSet is required. "

 

If I debug the program, I can see that the input passed to the vtkThreshold
is right and different from NULL.

 

So, my question is: Could somebody give me a clue about what is going wrong
and how to solve it, please? For example, is there an object that takes care
of memory management and is given me problems (a singleton class managing
memory and there is an instance in the executable and another in the DLL
when VTK is static)? 

 

Thanks,

        Xavi

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20071112/d6622480/attachment.htm>


More information about the vtkusers mailing list