Because all of my baseline code is in C++, I ended up writing a bunch
of shims for different operating systems.  I'm pretty familiar with
cross platform porting, so when I need something that ends up being
different on different platforms, I just write a shim for it.
Examples of shim layers would be general purpose thread handling,
tests for file existence, and basic network sockets.

Above the basic shim layer are some more modular pieces.  A really
good example is audio handling:  cross platform audio is a nightmare,
so I wrote my own audio stack containing the pieces I need and plug
that into a driver layer.  I'm currently using portaudio, but if I
needed to swap it out for something else, I could.

Another utter disaster for cross platform porting has been the
wxWidgets toolkit.  It's about as cross platform as something that's
completely not cross platform at all.  As a result of this, I use as
little of wx as possible, and use my own libraries instead.  Instead
of using wx threads, I use my threads; instead of using the buggy and
constantly crashing wx HTTP downloader, I use my own downloader.

I've really only been big on the cross platform thing for a couple
years now, but even so I have a pretty solid library of parts to work
with, and it's getting a lot easier to get things done on my supported
platforms.

The moral of my story is twofold:  First, be very wary of anything
which claims to be 'cross platform'.  In some cases, like wxWidgets,
'cross platform' means 'not at all cross platform in any way which is
actually useful for real projects'.  Be prepared to replace piece of
cross platform libraries which do not work correctly.

Second, be prepared to write your own shim code.  Isolate it as best
you can, design common interfaces for it, and put it somewhere
centralized.  Write quick and dirty test cases for it that run on all
your supported operating systems.  Avoid putting platform specific
code in your applications unless there's a logic organization reason
for it:  having different versions of fopen in your code is bad, but
having a chunk of code for windows apps which checks for administrator
permissions is probably necessary.

Dennis Towne

Alter Aeon MUD
http://www.alteraeon.com

---
Gamers mailing list __ [email protected]
If you want to leave the list, send E-mail to [email protected].
You can make changes or update your subscription via the web, at
http://audyssey.org/mailman/listinfo/gamers_audyssey.org.
All messages are archived and can be searched and read at
http://www.mail-archive.com/[email protected].
If you have any questions or concerns regarding the management of the list,
please send E-mail to [email protected].

Reply via email to