>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.
So how is using a prefix file at odds with what you want to do? Set up a
prefix file that #defines __palmos__, and your source files can look like:
----- MyFile.cpp ---
#if defined (__palmos__)
#include <Pilot.h>
#endif
#if defined (__WIN32__)
#include <Windows.h>
#endif
#if defined (UNIX)
#include <unix.h>
#endif
int main (void)
{
...
return 0;
}
Personally, I don't really consider a file so laden with #ifdefs to be
cross-platform, but I think this example is in the spirit of David
Williams's scenario.
-- Keith