[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/insight-developers/attachments/20170109/ae0b72ba/attachment.html>
More information about the Insight-developers
mailing list