[vtkusers] Auto-initialisation of Object Factories on Win32

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


It should. release is VTK 5.10.1 - ie VTK before modularization.

Modularization is the major ingredient of 6.0. One aspect of that is
this new concept of interface modules. It brings this requirement to
specify them in order to avoid getting NULL from the object factory,
which is an annoyance. The benefits it brings - finer grain libraries
and the possibility of using something _other_ than GL, for example -
should make it worthwhile once we all get the hang of it.

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 4:02 PM, Craig Henderson
<craig.henderson at intelligentultrasound.com> wrote:
> Hi David,
> I was building the 'master' branch from git. I've switched to 'release' and will rebuild. I had problems with many objects, not just vtkRenderingOpenGL. Will try the 'release' branch to see if that works.
>
> Thanks
> -- Craig
>
> On 19 Oct 2012, at 17:12, David E DeMarle <dave.demarle at kitware.com> wrote:
>
>> 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