[Insight-developers] I/O factory loading needs to be updated for Intel Macs/Mac OS 10.4 (easy fix)

Neil Weisenfeld neil at bwh.harvard.edu
Thu Jul 20 15:34:19 EDT 2006


I'm a fairly new Mac owner and am relying on a custom I/O factory that 
I've written for ITK.

Currently, builds on my Intel-based MacBook Pro (OS/X 10.4.7) cause a 
bus error when trying to load my custom module (but keep reading).

The ITK dynamic loading stuff in Code/Common/itkDynamicLoader.cxx has a 
special case for #ifdef __APPLE_.  This makes use of deprecated 
functions in order to perform dynamic module loading.  Simply disabling 
this special __APPLE__ case on my builds allows the normal Unix (dlopen, 
etc.) code path to be compiled in and this works correctly.

If this only applies to the Intel Macs, then a quick fix is to change

#if defined( __APPLE__ )
to
#if defined(__APPLE__) && !defined(__i386__)

should do the trick, however this Apple tech note seems to indicate that 
the method in use is simply deprecated (Apple says "discouraged"):

http://developer.apple.com/documentation/DeveloperTools/Reference/MachOReference/Reference/reference.html

It would be nice if this were fixed in the official release for me and 
the slicer branch as this breaks Slicer, too.  I guess I'm one of a 
small number of people who are using loadable I/O factories.  I'm not 
sure what the best fix is: are there still people running ITK on 
platforms that require the older NSLinkModule stuff, etc?  Maybe we can 
hear from some Mac experts in the audience.


Regards,
Neil


More information about the Insight-developers mailing list