Porting MFC (Windows) applications to Linux?

Wednesday, 8 June 2005 13:27 by CSchenk

Now that the commandline-version of the package manager is near completion, I wonder how complicated is it to port the Windows (MFC) version to Linux?

I take into consideration these strategies:

  1. Reimplement the application in C# (.NET), i.e., port it to Mono.
  2. Rewrite the MFC application using one of the free portable GUI toolkits:
    • It seems that wxWidgets (fka wxWindows) would be the right choice, since it resembles the MFC framework.
    • Qt is a well designed toolkit. But it is unclear whether the Windows version of Qt will be released under GPL.
    • GTK+ is released under LGPL and claims to be object oriented, though it is written in C.

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Related posts

Comments

June 9. 2005 15:03

sgrosse

According to Trolltech there will be a GNU Qt licence for windows:
www.trolltech.com/.../00000192.html
do you have doubts about this?

sgrosse

June 9. 2005 20:05

No, I have no doubt that they will release a GPLed version which supports the GNU toolchain (i.e, cygwin/mingw32). MiKTeX is built with Visual C++. And I doubt that Trolltech will support VC++. At least they say so in their FAQ.

CSchenk

June 10. 2005 00:16

Uwe Stöhr

Concerning Qt; what about the GPL'ed "Qt/Win Free" project:
http://sourceforge.net/projects/qtwin

It supports compilers from Microsoft and Borland. It is used for LyX's native Windows port and it works stable.

Btw. I don't have the doubt that Trolltech don't support MSVC.

regards Uwe

Uwe Stöhr

June 10. 2005 10:50

Thanks for the info. I didn't know qtwin. Looks promising.

CSchenk

June 13. 2005 10:29

burki

did you have a look at winelib (http://www.winehq.com/site/winelib). they managed to compile mfc. might not be the best long-term solution, but should be easier than a complete rewrite.

burki

June 20. 2005 16:24

Building MFC on Linux isn't an option (MFC
is not free). It would be an option for an
individual (or an in-house application).
But not for a freely distributable OpenSource
application.

CSchenk

June 26. 2005 07:52

Marco

Probably rewriting the MikTex project in C# is a good option. C# is the next generation of C++ that combines the best elements of C++ and Java. Microsoft has released C# to the open community through a standardization proposal. So, C# applications are free, and can be developed with Visual Studio and Mono without problems of licenses for open source. So far, there is a reasonable set of libraries for C#, that those can resemble MFC applications. Although C# is powerful and elegant, it might take a considerable effort to port the MikTex project.

Marco

Marco

July 5. 2005 16:16

serxio

you can also consider gtkmm, which is a c++ wrapper for gtk+. their libraries compile both in windows and linux, so you may even maintain a single version.

for someone that has used mfc, programming using gtkmm is trivial...


serxio

July 6. 2005 12:16

Franz

Have considered wxWidgets (www.wxWidgets.org)? It is an open-source cross-platform GUI library. It has quite similar concept and design in comparison to MFC. I used MFC since some years ago and then found no difficulty to switch to wxWidget.

Franz

July 10. 2005 18:11

Ilya Minkov

IBM has published an article: "Porting MFC applications to Linux - A step-by-step guide to using wxWindows" It is here:
www-128.ibm.com/.../

Since then, wxWindows was renamed to wxWidgets due to trademark reasons.

I believe wxWindows is the most sane variant, since it works most sanely on Windows, and quite sanely on GTK targets. Qtwin/free draws all controls by itself, and is thus somewhat non-native under windows. Same goes for GTK, with the addition that GTK is quite a heavyweight beast at least as i know it. GTK for Windows can import Windows XP skin, and it seems to be done similarly in Trolltech's stuff and Qtwin/free might go the same way in future. wxWidgets does not need that, it gains native look by utilising native controls.

Ilya Minkov

September 9. 2005 23:41

Nickolai Dobrynin

Dear Christian,

If you want to make this truly portable, I'd very much recommend GTK+ in its "pure" C version. GIMP for Windows is a perfect example of how well this works. Sure, C#/gtk# and gtkmm (the C++ version of GTK) are nicer to deal with, but they haven't been around for quite as long, especially in their Windows incarnation. Free/Libre version of QT, on the other hand, is nothing but PR at this point. Whether at all and when they will actually release it, and how long it will take it to stabilize is unclear. GTK+ is here, now, and stable. It's also very object-oriented, even though C-based.


Best regards,

Nickolai

Nickolai Dobrynin

September 11. 2005 04:40

Thanks for all the comments. I have taken a closer look at all the toolkits. If I had to choose a toolkit now:

Qt certainly has the cleanest design. It is well documented. And it has a huge user base.

Christian Schenk

November 7. 2005 17:31

Ernst Huber

My experience with Qt is that it's to be used nearly equal on Linux and Windows systems, i.e. with one source base the both OS could be perfectly served. It runs natively on the target platforms, so there is no need of cygwin/mingw32 on Win OS. For the GUI parts its Designer is a fine tool (and one can only hope that it doesn't get overloaded with "features" in the future). For Windows developers it comes with a plug-in (add-in) for the MS Visual Development Environment to simplify Qt development from within the IDE.
Opting for Qt could be the right choice - although wxWindows is also quite a decent product developed with commitment from their supporters. But at the end it could be simply a matter of "taste" - and for me Qt tastes better.

Ernst Huber

March 2. 2007 23:37

Sammy D'Souza

I would also take a look at MainWin from MainSoft. The principal advantage with MainWin is that it is a cross-compiler. Your code would still be Windows based (a.k.a. single source), yet MainWin will produce binary targets for Solaris, Linux, HP, Aix, you name it.

Sammy D'Souza

Comments are closed