<div dir="ltr"><div>Hi Matt,<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="font-size:12.8px">Here are the tests:</span><br style="font-size:12.8px"><span style="font-size:12.8px"> </span><a href="http://review.source.kitware.com/#/c/21755/" rel="noreferrer" target="_blank" style="font-size:12.8px">http://review.source.kitware.<wbr>com/#/c/21755/</a></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span style="font-size:12.8px">where reasonable export specification is added in both ITK and the</span><br style="font-size:12.8px"><span style="font-size:12.8px">client libraries. But, dynamic_cast fails on OSX:</span></blockquote><div><br></div><div>The export changes in this merge request don't seem to be related to the casts that are failing. A small change [1] allows all of the tests to pass. Of course, many more export annotations would be required for general applicability.</div><div><br></div><div>There is a compiler option that could potentially address the issue "-fvisibility-ms-compat" -- see [2]. As mentioned on that page, these RTTI type_info issues *also break exception handling*, so simply changing all of the ITK `dynamic_cast` uses to a custom implementation will not fully address the issue (I have encountered this a number of times in Slicer: ITK exceptions thrown by dynamic libraries are incorrectly identified).<br></div><div><br></div><div>Alternatively, if there is concern about symbol bloat (I've seen some threads to that effect related to SimpleITK) then a linker script could be used to export all `_ZTN*` symbols.</div><div><span style="color:rgb(0,0,0);white-space:pre-wrap"><br></span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">Best,</span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">Isaiah</span></div><div><br></div><div>[1] </div><div>```</div><div><div>diff --git a/Modules/Core/Common/include/itkImage.h b/Modules/Core/Common/include/itkImage.h</div><div>index 2e601c2..9592957 100644</div><div>--- a/Modules/Core/Common/include/itkImage.h</div><div>+++ b/Modules/Core/Common/include/itkImage.h</div><div>@@ -72,7 +72,7 @@ namespace itk</div><div> * \endwiki</div><div> */</div><div> template< typename TPixel, unsigned int VImageDimension = 2 ></div><div>-class Image:public ImageBase< VImageDimension ></div><div>+class ITK_ABI_EXPORT Image:public ImageBase< VImageDimension ></div><div> {</div><div> public:</div><div> /** Standard class typedefs */</div></div><div>```</div><div><br></div><div>[2] <a href="https://developer.apple.com/library/content/technotes/tn2185/_index.html#//apple_ref/doc/uid/DTS10004200-CH1-SUBSECTION2">https://developer.apple.com/library/content/technotes/tn2185/_index.html#//apple_ref/doc/uid/DTS10004200-CH1-SUBSECTION2</a> and <a href="https://developer.apple.com/library/content/technotes/tn2185/_index.html#//apple_ref/doc/uid/DTS10004200-CH1-SUBSECTION6">https://developer.apple.com/library/content/technotes/tn2185/_index.html#//apple_ref/doc/uid/DTS10004200-CH1-SUBSECTION6</a></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Nov 12, 2016 at 12:01 AM, Matt McCormick <span dir="ltr"><<a href="mailto:matt.mccormick@kitware.com" target="_blank">matt.mccormick@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Here are the tests:<br>
<br>
<a href="http://review.source.kitware.com/#/c/21755/" rel="noreferrer" target="_blank">http://review.source.kitware.<wbr>com/#/c/21755/</a><br>
<br>
where reasonable export specification is added in both ITK and the<br>
client libraries. But, dynamic_cast fails on OSX:<br>
<br>
<a href="https://open.cdash.org/testDetails.php?test=499059765&build=4637669" rel="noreferrer" target="_blank">https://open.cdash.org/<wbr>testDetails.php?test=<wbr>499059765&build=4637669</a><br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
Matt<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Thu, Nov 10, 2016 at 3:21 PM, Johnson, Hans J <<a href="mailto:hans-johnson@uiowa.edu">hans-johnson@uiowa.edu</a>> wrote:<br>
> I agree with Marcus. At least until it is very clear that not using dynamic_cast is the only solution to a broken compiler, I am very weary of “doing what works today”.<br>
><br>
> Hans<br>
><br>
><br>
> --<br>
><br>
><br>
> On 11/10/16, 1:11 PM, "Insight-developers on behalf of Marcus D. Hanwell" <<a href="mailto:insight-developers-bounces@itk.org">insight-developers-bounces@<wbr>itk.org</a> on behalf of <a href="mailto:marcus.hanwell@kitware.com">marcus.hanwell@kitware.com</a>> wrote:<br>
><br>
> On Tue, Nov 8, 2016 at 5:01 PM, Matt McCormick<br>
> <<a href="mailto:matt.mccormick@kitware.com">matt.mccormick@kitware.com</a>> wrote:<br>
> > Hi folks,<br>
> ><br>
> > As we have wrestled with in Slicer, along with other applications<br>
> > where ITK is used in multiple shared libraries, dynamic_cast can fail<br>
> > on Mac OSX.<br>
> ><br>
> > I summarized the cause of the problem and steps for the proposed solution here:<br>
> ><br>
> > <a href="https://issues.itk.org/jira/browse/ITK-3490" rel="noreferrer" target="_blank">https://issues.itk.org/jira/<wbr>browse/ITK-3490</a><br>
> ><br>
> > Feedback is welcome. The effort is targeted for the ITK 4.11.0 release.<br>
> ><br>
> From the issue it is not clear to me why you can't fix the symbol<br>
> visibility issues, or which of these cases it causing the breakage.<br>
> Reading the linked blog post it seems like Apple/Clang is doing the<br>
> right thing, and C++ libraries must be careful to use consistent<br>
> symbol visibility.<br>
><br>
> I would be interested in further details on which case or cases are<br>
> causing dynamic_cast to fail, and why using consistent symbol<br>
> visibility in the interfaces is not feasible/possible.<br>
><br>
> Thanks,<br>
><br>
> Marcus<br>
> ______________________________<wbr>_________________<br>
> Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
><br>
> Kitware offers ITK Training Courses, for more information visit:<br>
> <a href="http://kitware.com/products/protraining.php" rel="noreferrer" target="_blank">http://kitware.com/products/<wbr>protraining.php</a><br>
><br>
> Please keep messages on-topic and check the ITK FAQ at:<br>
> <a href="http://www.itk.org/Wiki/ITK_FAQ" rel="noreferrer" target="_blank">http://www.itk.org/Wiki/ITK_<wbr>FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://public.kitware.com/mailman/listinfo/insight-developers" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/insight-<wbr>developers</a><br>
><br>
><br>
______________________________<wbr>_________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://kitware.com/products/protraining.php" rel="noreferrer" target="_blank">http://kitware.com/products/<wbr>protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" rel="noreferrer" target="_blank">http://www.itk.org/Wiki/ITK_<wbr>FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/insight-developers" rel="noreferrer" target="_blank">http://public.kitware.com/<wbr>mailman/listinfo/insight-<wbr>developers</a><br>
</div></div></blockquote></div><br></div>