Cross platform compiling (SDL)

Started by
12 comments, last by Grellin 19 years, 6 months ago
I hadn't thought about it but that is a good question. What is the real difference? It would seem that whatever machine it was compiled on would understand what to do with the variable types.

Steven Bradley .:Personal Journal:. .:WEBPLATES:. .:CGP Beginners Group:. "Time is our most precious resource yet it is the resource we most often waste." ~ Dr. R.M. Powell
Advertisement
You still have to handle endian issues yourself when porting to a platform like the mac. This really only becomes a problem when loading binary data from files or over the network.

What the SDL defined types are really there for are ensuring that you get the right *size* of data. On desktop machines it's less important, but SDL also runs on a lot of small devices (PDAs, etc), which may have very different capabilities.

A Sint32 will always be 32 bits on any platform. An int might be 16 or 64 depending on the platform.
I'm not up to speed with WinXP, so forgive me if I'm wrong.

In my experience working with the different filesystem strategies can be a pain, particularly when dealing with stuff in the user's home directory. This thing just doesn't exist in Windows (at least up to ME), so you might have to code in a "Profile" system in your game if you want different people to be able to play with different settings/variables/whatever. With Linux (UNIX in general) you can just stuff the user specific variables somewhere in their home folder and you won't ever need to care about that "Profiles" crap.

Or you can ignore multiple users and have the same variables for every player. This is a problem on Linux since most of the time the only place your app is allowed to write to is the user's home directory.

So, you either need a hack for Linux (write to user's home instead of regular global place), or a hack for Windows (add some sort of profiles system). The problem with the latter is that there will likely be multiple profiles for each user in Linux.

If WinXP has user home folders by default, then all this stuff also applies to support between newer (XP) and older (ME) version of Windows.
My stuff.Shameless promotion: FreePop: The GPL god-sim.
Quote:Original post by RichardS
You still have to handle endian issues yourself when porting to a platform like the mac. This really only becomes a problem when loading binary data from files or over the network.

What the SDL defined types are really there for are ensuring that you get the right *size* of data. On desktop machines it's less important, but SDL also runs on a lot of small devices (PDAs, etc), which may have very different capabilities.

A Sint32 will always be 32 bits on any platform. An int might be 16 or 64 depending on the platform.


Thanks, makes perfect sense. ++



Steven Bradley .:Personal Journal:. .:WEBPLATES:. .:CGP Beginners Group:. "Time is our most precious resource yet it is the resource we most often waste." ~ Dr. R.M. Powell

This topic is closed to new replies.

Advertisement