[ITK] [ITK-dev] Workaround for dynamic_cast on Mac OSX

Matt McCormick matt.mccormick at kitware.com
Mon Jan 9 19:22:00 EST 2017


On Mon, Nov 14, 2016 at 6:36 PM, Matt McCormick <matt.mccormick at kitware.com>
wrote:

> On Mon, Nov 14, 2016 at 2:53 PM, Isaiah Norton <isaiah.norton at gmail.com>
> wrote:
> > Hi Matt,
> >
> >>
> >> Here are the tests:
> >>   http://review.source.kitware.com/#/c/21755/
> >>
> >> where reasonable export specification is added in both ITK and the
> >> client libraries. But, dynamic_cast fails on OSX:
>
>
> We will test further with Python wrapping for OSX with the
> ITKCommon_TEMPLATE_EXPORT approach, then investigate
> -fvisibility-ms-compat if that does not prove viable.
>

To follow-up, after further investigation, we used the equivalent of
ITKCommon_TEMPLATE_EXPORT but called it ITK_TEMPLATE_EXPORT so the same
macro can be used across multiple modules. This macro is defined
to __attribute__ ((visibility ("default"))) on OSX. As noted here [1], this
is the same approach taken by libstdc++ for the templated STL containers:

"Part of the std:: (exceptions typeinfo symbols) must be visible-by-default
for proper throw-catch/dynamic_cast working across shared libs boundaries."

This is available in ITK 4.11.

Thanks,
Matt

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50348
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20170109/ae0b72ba/attachment.html>
-------------- next part --------------
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-developers


More information about the Community mailing list