views:

71

answers:

3

I've been tasked with porting an existing Windows GUI app to Linux. Ideally, I'd like to do this so the same code base can be used to build either the Windows version or the Linux version. I'll be doing my work on Ubuntu 9.04. After searching around, it's unclear to me what tools are best suited to help me with this.

A list of loose requirements would be:

  1. The code is in C, not C++, and should compile to build both Windows and Linux versions. Since it's existing code, and fairly large, converting to a managed language like .NET is out of the question for now.

  2. I would prefer if I can use the same dialogs in both systems. In Windows, putting up a dialog is pretty simple. You build the dialog in the Resource Editor in Visual Studio, then call DialogBox() API, and handle the event messages. I would really like to find something that can do the equivalent on the Linux side.

  3. It would also be nice to have a good IDE similar to Visual Studio.

Any helps or hints would be appreciated.
Thanks,

+1  A: 

Since your code base is in C, I'd suggest using GTK+. It's a cross platform GUI toolkit. For instance, Pidgin instant messenger GUI is created with GTK+. Glade user interface designer can be used to graphically design UIs.

Mehrdad Afshari
Check out the Glade tutorials. The main difference in approach is that GTK+ uses function callbacks for events, rather than posting messages.
caf
+5  A: 

Winelib should let you compile Win32 code under Linux with only a few modifications.

Ignacio Vazquez-Abrams
Winelib is probably the best bet, especially given the requirement that existing dialog (resources) should be used.
Chris Becke
A: 

If you're on a tight budget, and don't mind taking time to work around a fair number of limitations, Winlib is an option. If you're shorter on time, and have a larger budget, you might want to look into Mainsoft instead. It's not exactly perfect, but I believe it supports a considerably larger part of the Win32 API (at a correspondingly higher price).

Jerry Coffin
Excellent. Thanks to all of you for the help. I'll probably try WineLib first, since that sounds like it might be the easiest and least disruptive way to go, and then Mainsoft if Winelib doesn't work out.
Warner Young
It turns out that Winelib doesn't do what I want, since it produces a binary that still requires Wine to run. I'm currently checking out Anjuta IDE and Glade, which seem closer to what Visual Studio does.
Warner Young