Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Port to Linux, or write wrappers for MFC?

Tags:

c++

qt

mfc

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.

like image 889
E.Freitas Avatar asked Feb 04 '26 09:02

E.Freitas


1 Answers

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.

like image 173
Alok Save Avatar answered Feb 06 '26 00:02

Alok Save



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!