Question

Is it easier to separate the core functionality of a program and port it to Linux, or to write wrappers around the MFC functionality to get the original MFC program running in Linux?

Example:

Take your basic dialog based MFC application (several dialog windows), get it to run under Linux command line without modification of the core analysis code. The main goal is to NOT modify the analysis code. With that in mind, write a command line version of the program that uses the same files that the MFC application uses for the analysis code. Write code that will act exactly like the MFC classes and functions that are used in the analysis code. In fact, just start with the MFC source code for those classes, cut out all the Microsoft specific stuff (MFC, ATL, etc..) and use this for your wrapper code.

versus:

Take the core analysis code, plug it into a Qt command line project. For any MFC or Win32 functionality, replace it with the equivalent cross-platform compatible functionality from either Qt or STL/Boost.

Was it helpful?

Solution

Try compiling it against Winelib and you won't have to rewrite most of the functionality.

In the light of your comments, Given the time and resources I would definitely separate the source code in to well defined layers:

An OS/platform dependent layer,
An OS Abstraction Layer,
An OS independent middleware &
An UI layer

This is the most basic layered architecture one would encounter in any software application. That way Whenever I need to port it to a new Operating system/Platform, I just need to write a OS/platform dependent layer and all my other layers remain unchanged. Similarly, when need arises to change the UI framework I can easily just modify the UI layer and rest of the stack remains unchanged.

Ofcourse, such an solution needs ample time and resources at your disposable but once you do, your life is much easier in future.

OTHER TIPS

Having enough time and resources I would do the second option, it seems to me a cleaner approach. If a quick&dirty solution is needed, instead, you could follow @Als' suggestion and use Winelib.

By the way, Qt and STL/Boost are multiplatform libraries, so in a future you could use the "ported" version as a multiplatform version, deploying it also on Windows and getting rid of the MFC dependency (advantage: only one code base to work on; disadvantage: Qt is a quite heavy dependency).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top