[vtkusers] Auto-initialisation of Object Factories on Win32

David E DeMarle dave.demarle at kitware.com
Fri Oct 19 12:12:22 EDT 2012


Are you using vtk development head (ie what will become 6.0)?
  If so the problem is that your application depends on vtkRendering,
but you haven't specified that vtkRenderingOpenGL is to be the
implementation of that module.

From:
http://vtk.org/Wiki/VTK/Build_System_Migration
"
The application code must list vtkRenderingOpenGL in its components to
use OpenGL for rendering and include the VTK_USE_FILE to add compiler
definitions. This ensures that the object factory for the
vtkRenderingOpenGL module will be initialized and uses whenever
classes from vtkRenderingCore are uses in your application code. If
you notice the interface classes in these modules returning NULL
pointers it is likely that one of these implementation modules
providing appropriate overrides is missing from the dependency list.
"

Do that by either using the first cmakelist from the Finding and
Linking to VTK section or make sure that vtkRenderingOpenGL shows up
in your COMPONENTS and link libraries lines in the other two.

David E DeMarle
Kitware, Inc.
R&D Engineer
21 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4909


On Fri, Oct 19, 2012 at 11:36 AM, Craig Henderson
<craig.henderson at intelligentultrasound.com> wrote:
> Hi, I have been searching for a way to enable Auto-initialisation of Object
> Factories on Windows (MSVC), but without success. Most calls to
> Object::New() are returning null pointers and stepping through the code I
> can see the factory is missing.
>
>
>
> To prove the case, I added this block to my code, and New() worked for
> vtkRenderingOpenGL.
>
>
>
> _declspec(dllimport) void vtkRenderingOpenGL_AutoInit_Construct();
>
> vtkRenderingOpenGL_AutoInit_Construct();
>
>
>
> I guess there’s a simple compiler option when building VTK, but cannot find
> it anywhere.
>
>
>
> Thanks for your help
>
> -- Craig
>
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



More information about the vtkusers mailing list