[vtkusers] vtkFollower

David Cole DLRdave at aol.com
Sun Nov 16 15:13:18 EST 2014


This seems quite odd. I would expect everything to work as you'd
expect when everything is built as DLLs (including your VTK wrapper
lib and all the VTK libraries...)

However, VTK does have some global state, so if you are using it in a
static library, you have to make sure that the VTK static library is
linked into exactly one DLL *or* directly into the application itself.
If you link the static lib VTK into multiple DLLs, then each one will
have its own copy of VTK's global state, and stuff that depends on the
global state will not work properly if you have calls dispersed and
intertwined across multiple DLLs. (Every object's "modified time," for
example, is based on one little bit of VTK's global state... and many
things depend on comparing modified times for multiple objects to
decide what needs updating. If that gets confused, then much
misbehavior will eventually follow...)

In short, the rule of thumb for linking VTK is: if linking statically,
also link everything that uses VTK statically all directly into the
same entity, either the application or a single DLL. And if that's not
feasible, then use VTK in DLL form.

Does that make sense? (Although it sounds like you have problems when
building VTK in DLL form, which doesn't make a lot of sense to me...)

HTH,
David C.



On Fri, Nov 14, 2014 at 2:56 PM, Totte Karlsson
<totte at dunescientific.com> wrote:
>
> On 11/13/2014 3:48 AM, David Cole wrote:
>>
>> Do you reference (link to) VTK from multiple DLLs, or just the one?
>
> There are several DLL's using the 'one' that links to the vtk libs (I call
> it vtk-wrapper-lib below).
> Hiearchy is something like this (may look weird depending on the font):
>
>              application
>            /                \
>       DLL-A            DLL-B
>           \                     /
>          VTK-wrapper-lib
>                    |
>          vtk static libs
>
>
> If the VTK wrapper lib is built as a static lib everything seem to work
> fine.
> If I build it as a shared library, on the other hand, the vtkFollowers don't
> work properly.
> I also built all vtk libs as shared libs(dlls), but that does not seem to
> change anything.
>
> tk
>
>
>> On Wed, Nov 12, 2014 at 3:06 PM, Totte Karlsson
>> <totte at dunescientific.com> wrote:
>>>
>>> I meant vtk version 6.1 ,
>>> tk
>>>
>>> On 11/12/2014 10:33 AM, Totte Karlsson wrote:
>>>>
>>>> Hello,
>>>> I have an application that are using vtk (6.2) trough a custom static
>>>> library (vtk linked to this one and built static too).
>>>> In a scene rendered I have some vtk followers and everything works fine
>>>> when interacting with the scene.
>>>>
>>>> However, when I build my intermediate library as DLL (vtk still static),
>>>> everything works except that the vtkFollowers don't work properly. With
>>>> properly I mean they do only face the camera sometimes and
>>>> 'sporadically'.
>>>>
>>>> Anyone seen this behavior? any ideas?
>>>>
>>>> I'm using CodeGear XE3 compiler on windows.
>>>>
>>>> tk
>>>> _______________________________________________
>>>> 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://public.kitware.com/mailman/listinfo/vtkusers
>>>
>>>
>>> --
>>> .........................
>>> Totte Karlsson, Ph.D.
>>> Dune Scientific, LLC
>>> 425-296 1980 (office)
>>> 425-780 9648 (cell)
>>> www.dunescientific.com
>>> .........................
>>>
>>> _______________________________________________
>>> 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://public.kitware.com/mailman/listinfo/vtkusers
>
>
> --
> .........................
> Totte Karlsson, Ph.D.
> Dune Scientific, LLC
> 425-296 1980 (office)
> 425-780 9648 (cell)
> www.dunescientific.com
> .........................
>
> _______________________________________________
> 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://public.kitware.com/mailman/listinfo/vtkusers


More information about the vtkusers mailing list