« Security Update 2004-06-07 | Main | Goodbye, Mr. Hamilton »

June 8, 2004

#ifdef and Mac OS X

There are a number of command-line programs and daemons out there that barf on Mac OS X, trying to treat it like classic Mac OS.

The cause is this in a source file:


#ifdef __APPLE__
/* stuff */
#endif

To avoid this, you only need remember that Mac OS X has its roots in NeXT (and BSD, by extension), and will respond to many things the same way NeXTStep would. To allow building on both Mac OS X and Mac OS 9 or earlier, most programs simply need two lines added:


#ifndef NeXTBSD /* Allow compilation on NeXT and Darwin */
#ifdef __APPLE__
/* stuff */
#endif
#endif

Posted by Colin at June 8, 2004 3:43 PM

Trackback Pings

TrackBack URL for this entry:
http://blog.tigre-tech.net/mt/mt-tb.cgi/83

Comments

Post a comment




Remember Me?

(you may use HTML tags for style)