Jump to content

Please: step by step guide for converting existing program to cross-platform

- - - - -

  • Please log in to reply
4 replies to this topic

#1
gganem

gganem

    Newbie

  • Members
  • PipPip
  • 13 posts
Hi,

I developed a simple C++ program under the following environment:
* OS: Windows 7 (my laptop's).
* CodeBlocks 10.05
* A graphics library that supports practically all platforms, including of course Windows 7.
* I only used this special library, the rest are C++ standard libraries.
* Calls to Windows functions are standard (at least I never saw any remark about "Windows 7-only". I don't have a reference book, I got the info from several tutorials/examples at Internet).


The resulting program runs only on Windows 7. I am being asked to generate a Windows XP version and a Mac version. I don't have a clue of how to do that! (In fact, I don't have a clue if there is only "one" Mac version or "one" W-XP, for instance!). Should I simply get hold of an Windows XP machine, install CB 10.05 and recompile there (same recipe for a Mac?). Or can I generate the corresponding executables from my Windows 7 machine?

Step-by-step beginner's guide for program migration will be welcome!:)

#2
ZekeDragon

ZekeDragon

    Writes binary right handed and hex left handed

  • Moderators
  • 2,103 posts
This depends entirely on what program code you utilized in your program. If your code is standards compliant and if there is external libraries, those libraries are cross-platform for Mac and WinXP than you should be fine simply moving the code over and recompiling, it really should be that simple.

You write that you used the one special library, a graphics library that supports many platforms. You should be fine with that library, but you also say that you call Windows functions. Regardless of how 'standard' the Windows-specific calls are for Windows, they aren't standard across all platforms, so your port will have to replace those functions with equivalent Mac functions or your program will need to remove or otherwise emulate that functionality for the port to work correctly.

There is no "recipe" for making a port, it's really just about getting the code to be no longer reliant on the platform specific functions, objects, or data of the current platform and replace those with calls on the target platform, then recompile it using a compiler on that machine. Pure standard C++ should port everywhere there's a standard compliant C++ compiler.
Wow I changed my sig!

#3
gganem

gganem

    Newbie

  • Members
  • PipPip
  • 13 posts
Thanks for the answer.

Is there any online resource (or book) that I can refer to for comparing Windows XP vs Windows 7 calls, so that I can work on this aspect prior to recompiling on a Windows XP machine? I am 99% that the rest of the code is standard C++ (Mac is not much of a priority right now, but a lot of users seem to be still on Windows XP).

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
General rule of thumb: if it recompiles on a Windows XP/Mac, you're in good shape. It tends to depend on the number of special calls, if any, as to how hard it will be.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#5
bbqroast

bbqroast

    Codecall Addict

  • Members
  • PipPipPipPipPipPipPip
  • 554 posts
  • Location:/etc/passwd
Grab a WinXP disc and use virtual box to put it on your computer (you'll have a window open in Win7 that has WinXP inside it), then install Code::Blocks, set it up (with your external libraries), copy and paste, compile. Then take advantage of your forums with your errors (first try Googling eg. "wn7closeprogram() Windows XP equivalent).

You won't be the first to have problems 99% of the time.
Please, write clearly with proper structure. Double spacing makes the text feel un-jointed, Capitalizing Every Word Means People Stop Before Every Word Sub-Consciously Which Is A Pain In The Backside, and use code tags! (The right most styling box).




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users