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

Isaiah Norton isaiah.norton at gmail.com
Tue Nov 22 11:22:59 EST 2016


On Tue, Nov 22, 2016 at 9:33 AM, Lowekamp, Bradley (NIH/NLM/LHC) [C] <
blowekamp at mail.nih.gov> wrote:
>
> There appears to be ways to pass the linker list of symbols or REGEX of
> symbols to export (-export-symbols and -export-symbols-regex). Perhaps
> instead of monkeying too much with the ITK casting and class export
> specification, maybe a regex for the RTTI or a generated list of symbols
> could be generated to export for the problematic configuration for WrapITK?
>

These are libtool options, and they aren't supported by the OS X version of
libtool. There is a related `-exported_symbols_list` ld option, but the
Apple documentation warns that the export list cannot positively override
the symbol visibility set by the compiler:

https://developer.apple.com/library/content/technotes/
tn2185/_index.html#//apple_ref/doc/uid/DTS10004200-CH1-SUBSECTION5

On a related note, I looked at the implementation of
`-fvisibility-ms-compat` in Clang, and it turns out there is a
corresponding `__attribute__(type_visibility(...))` annotation which could
be used on class declarations. See:

http://stackoverflow.com/questions/28437772/what-does-
clangs-type-visibility-attribute-do-and-when-should-one-use-it

But the annotation is not supported by GCC, so `visibility-ms-compat` is
probably still a better option to allow compatibility with both OSX and
Linux.

Best,
Isaiah




Just another thought.
> Brad
>
> > On Nov 15, 2016, at 10:17 AM, Lowekamp, Bradley (NIH/NLM/LHC) [C] <
> blowekamp at mail.nih.gov> wrote:
> >
> >
> >> On Nov 14, 2016, at 6:18 PM, Matt McCormick <matt.mccormick at kitware.com>
> wrote:
> >>
> >> On Mon, Nov 14, 2016 at 2:18 PM, Lowekamp, Bradley (NIH/NLM/LHC) [C]
> >> <blowekamp at mail.nih.gov> wrote:
> >>> Matt,
> >>>
> >>> I believe that GCC 4.1 also had a very similar problem to what is
> occurring in with Apple Clang now.
> >>
> >> Thanks to the GCC version dashboard builds that you maintain, we
> >> should be able to see if other GCC's have that issue, too :-).
> >>
> >
> > Based on the good information Isaiah has referenced: It may be that the
> prior gcc 4.1 behavior was due to the version of libstdc++ that was
> distributed with gcc 4.1, so with the dashboard system using gcc4.1 with
> libstdc++.so.6.0.19 at runtime may have different behavior.
> >
> >>
> >>> It’s interesting to note that Slicer CLI interface does not contain
> ITK templated objects. Does Slicer use ITK objects any where in it’s public
> API’s?
> >>
> >> Note that this issue becomes predominantly problematic when ITK
> >> templated objects are not in the ABI but used internally (as in the
> >> test case).
> >>
> >>
> >> Thanks,
> >> Matt
> >
> > I’m not sure what the right term is. Yes, in the test case the templated
> object is not explicitly in the ABI/API of the library, but the method
> exposes private templated objects by producing objects which are intended
> to be “cast" to the templated object. So by documentation and behavior
> instances of private templated object are exposed in the API of the test
> case?
> >
> > So my point? I think that developing a clean interface without excessive
> multiple instances as well as not exposing private instance is important
> and should be the first approach. If there are places remaining in Slicer
> or ITK which “expose” private symbols I would like to help to directly
> address them.
> >
> > I also acknowledge that some interfaces were not designed with this in
> mind and are limited in their ability to meet these best practices and
> therefor need the “SafeDownCast” work around.
> >
> > I think I have gone past my 2 cents on this issue.
> >
> > HTH,
> > Brad
> > _______________________________________________
> > slicer-devel mailing list
> > slicer-devel at bwh.harvard.edu
> > http://massmail.spl.harvard.edu/mailman/listinfo/slicer-devel
> > To unsubscribe: send email to slicer-devel-request at bwh.harvard.edu with
> unsubscribe as the subject
> > http://www.slicer.org/slicerWiki/index.php/Documentation/
> Nightly/Developers/FAQ
>
> _______________________________________________
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-developers/attachments/20161122/c823c3d4/attachment.html>


More information about the Insight-developers mailing list