--On Monday, October 17, 2005 11:01 PM -0400 Ed Hill <ed@xxxxxxx> wrote:
Do you have to write the hardware-detection code in C or assembly? I ask because one way to solve the hardware-detection problem is to ship two or more binaries that have each been optimized/tuned for different processors or processor capabilities (eg. multi-processor, SSE2, SSE3, etc.). When the user runs the program, he/she calls a shell script (eg. bash) that determines what sort of hardware and OS support are present and then selects and runs the best binary for that machine. I've seen many applications that use this shell-script-wrapper approach and it can work in a graceful and user-friendly fashion.
I can safely ship separate binaries for 32 and 64 bit, but I'd like to avoid splitting it out further than that. (The project is a free game based on a commercial engine. <http://renwerx.com/>) I haven't yet looked closely at what's done with the CPU identification to see how much it selects code based on the information.
And I've yet to encounter the pointer serialization problem that you describe (luckily, all my C++ objects can be serialized without use of pointers).
In this case, the serialization can be performance-sensitive, as some objects need to be shipped from a game server to a game client. And I expect mixed 32 and 64 bit combinations of clients and servers, so I can't just change the object definitions. Plus, some data files generated by separate tools rely on the existing layout. Fun.