Thanks to everyone who responded to my posting asking whether there was some
predefined preprocessor symbol indicating that CodeWarrior is building for
PalmOS.

It turns out that the compiler itself does define __PALMOS_TRAPS__, as Michael
Yam suggested.  This is basically what I was looking for, although the name
__PALMOS_TRAPS__ is unfortunate and is unfortunately undocumented.  The symbol
EMULATION_LEVEL gets defined in PalmOS header files, not by the compiler.

A number of people suggested that I can use a prefix file in my CodeWarrior
project file to define a symbol indicating that we are building for PalmOS,
which is OK, but I was really looking for a way to write a cross-platform source
file which can be dropped into any project.

In conclusion, CodeWarrior SHOULD define a symbol such as "__palmos__" or "palm"
when building for PalmOS, and this should be documented and supported behavior.
Of course, virtually every other C compiler defines a symbol indicating the
target platform.  I suggest that CodeWarrior define the symbol "__palmos__";
that would be convenient for programmers since GCC defines "__palmos__" when
compiling code for PalmOS.

-adam

Michael Yam <[EMAIL PROTECTED]> wrote in message
news:7hclqs$[EMAIL PROTECTED]...
> A quick check of my old email found the following:
>
> From Keith Rollin:
> >>>>>
> You might want to try something like:
> #if defined (EMULATION_LEVEL) && (EMULATION_LEVEL == EMULATION_NONE)
> ..
> #endif
> Those symbols are defined when compiling Palm OS applications.
> <<<<<
>
> From Scott Johnson:
> >>>>>
> You can try these:
>
>              __MWERKS__
>              __MC68K__
>              __PALMOS_TRAPS__
>
> The 3rd one doesn't seem to be documented anywhere.
> <<<<<
>
> Michael Yam
> Y Technology, Inc.
> [EMAIL PROTECTED]
>
>
> -----Original Message-----
> From: Adam Dingle <[EMAIL PROTECTED]>
> To: Palm Developers Forum List <[EMAIL PROTECTED]>
> Date: Wednesday, May 12, 1999 2:59 PM
> Subject: Fw: does CodeWarrior predefine a preprocessor symbol when
> building for Palm?
>
>
> >Here's a message I just sent to CodeWarrior Support at Palm.  Can
> anyone on this
> >mailing list answer this question?
> >
> >-adam
> >
> >----- Original Message -----
> >From: Adam Dingle
> >To: CodeWarrior Support
> >Sent: Wednesday, May 12, 1999 11:53 AM
> >Subject: does CodeWarrior predefine a preprocessor symbol when building
> for
> >Palm?
> >
> >
> >Dear Palm/Metrowerks,
> >
> >the CodeWarrior documentation section "Predefined Symbols" lists a
> symbol
> >"macintosh" which CodeWarrior defines when compiling code for a Mac.
> Does
> >CodeWarrior for PalmOS define a similar symbol (such as "palm") when
> compiling
> >code for a PalmOS device?  I write code which may be compiled for
> several
> >different platforms, and I would like to be able to use an #ifdef to
> >conditionally include certain headers when compiling for PalmOS only.
> >
> >Thanks -
> >
> >-adam
> >
> >
> >
> >
>
>
>
>
>

Reply via email to