discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Portability/Compatability between GNUstep <---> Cocoa...


From: Nicola Pero
Subject: Re: Portability/Compatability between GNUstep <---> Cocoa...
Date: Tue, 13 Jan 2004 12:08:09 +0000 (GMT)

On Tue, 13 Jan 2004, Kazunobu Kuriyama wrote:

> Alex Perez wrote:
> 
> >>> Not sure what you are asking for. But if you only want to find out if
> >>> your code compiles in a GNUstep or a MacOSX environment a test for
> >>> #ifdef GNUSTEP should do.
> >>>
> >> This seems to be just the one I'm seeking for. Which file defines the
> >> macro? Or is this
> >> one defined by each programmer?
> >
> >
> > The problem with #ifdef GNUSTEP is that, AFAIR, it is still defined if 
> > you
> > use GNUstep-make to build under OS X. That's no good. Apple's GCC always
> > defines __APPLE__ and there's also MAC_OS_X (or is it MAC_OSX, I can 
> > never
> > remember..)
> 
> Thank you for the information.
> 
> When an Apple machine has both GNUstep and Cocoa library, we can't use
> __APPLE__ alone to distinguish these libraries one another.
> 
> Also, if I remember correctly, there were emails on this list which told
> some people use GNUstep-make on Mac.  In this case, the predefined macro
> GNUSTEP doesn't work for the distinction I need, i.e.,
> 
> #if SOME_MACRO
>     <GNUstep proper code comes here>
> #else
>     <Cocoa proper code comes here>
> #endif

Of course it does.  gnustep-make is intelligent enough to know if you are
compiling with gnustep's or with Apple's frameworks, and to #define
GNUSTEP if and only if you are compiling against gnustep's frameworks.

So, 

#ifdef GNUSTEP

  <GNUSTEP code here>

#else

  <Cocoa code here>

#endif /* GNUSTEP */

is what you are looking for.  Renaissance uses it all the times. :-)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]