Alex Rivera | Logout

What's your favorite way of dealing with cross-platform development?

Asked 2009-02-25T15:06:23.177
10

I'm currently working on cross-platform applications and was just curious as to how other people tackle problems such as:

  • Endianess
  • Floating point support (some systems emulate in software, VERY slow)
  • I/O systems (i.e. display, sound, file access, networking, etc. )
  • And of course, the plethora of compiler differences

Obviously this is targeted at languages like c/c++ which don't abstract most of this stuff (unlike java or c#, which aren't supported on a lot of systems).

And if you were curious, the systems I'm developing on are the Nintendo DS, Wii, PS3, XBox360 and PC.


EDIT
There have been a lot of really good answers on here, ranging from how to handle the differences yourself, to library suggestions (even the suggestion of just giving in and using wine). I'm not actually looking for a solution (already have one), but was just curious as to how others tackle this situation as it is always good to see how others think/code so you can continue to evolve and grow.

Here's the way I've tackled the problem (and, if you haven't guessed from this list of systems above, I'm developing console/windows games). Please keep in mind that the systems I work on generally don't have cross-platform libraries already written for them (Sony actually recommends that you write your own rendering engine from scratch and just use their OpenGL implementation, which doesn't quite follow the standards anyway, as a reference).

Endianess
All of our assets can be custom made for each system. All of our raw data (except for textures) is stored in XML which we convert to a system specific binary format when the project is built. Seeing as how we are developing for game consoles, we don't need to worry about data being transfered between platforms with different endian formats (only the PC allows the users to do this, thus, it is insulated from the other systems as well).

Edit
Report

2 Answers

4

I usually encapsulate system-specific calls in a single class. If you decide to port your application to a new platform, you only have to port one file...

answered 2009-02-25T15:15:50.237
0

For things like endianness using different functions or classes is a bit nore overhead. try using the pre-processor like:

#ifdef INTEL_LINUX:
   code here
#endif

#ifdef SOLARIS_POWERPC
   code here
#endif
answered 2009-02-25T15:28:25.883

Your Answer