Porting a Windows application to Mavericks.

  • I am currently working on a project wherein an automatic update tool notifies the user of new product releases, bug fixes etc. This software is working on Windows but now I need to port in to Macintosh to make it cross-platform. The entire code has been written in Qt but has been written in Windows native C++. By that I mean, that a large number of Windows API calls have been made along with a batch file.
    Obviously, because of that the code wouldn't compile on C++ even if Qt is cross-platform. I understand there is no line-to-line conversion for Windows API to Mac. I am clueless on how to begin. Do I need to write those commands in Objective C and then add it into the Qt pro file or refactor the entire Windows code. Help and guidance would be appreciated.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    The first thing you should do is write down what each windows native API does and if they make sense on OS X. Depending on the API you may be able to use OS X C APIs or have to write some Objective-C/C++. You'll indeed have to refactor your code to separate native code. You have generally two options here:

    Use ifdefs

    Use a separate file for the platform specific part e.g. myclass_win.cpp myclass_osx.cpp

    Hope it helps

    1. Rewrite as much as possible of the Windows specific code by cross-platform code, using the C++ Standard Library and/or Qt. For the rest, see SGaist's 1 and 2.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.