winelib + MFC

Francois Gouget fgouget at codeweavers.com
Tue Mar 13 12:26:25 CST 2001


   Hi Carl,

carl wong wrote:
> 
> I am trying to port an MFC app to Linux using winelib. Can someone please
> give me a pointer or two???  I have looked at  section 4 of the online
> documentation and not much were mention there.

   Sorry, about section 4 of the Winelib User Guide. It's true that it's
not very complete yet. Here's basically what you need to do:

 * First you need to run winemaker on the MFC sources. Preferably you
should run it in '--interactive' mode to specify the right options for
the MFC and the ATL part (especially to get the include paths right).

 * Then comes the long job of making the thing compile. The MFC don't
yet compile 'out of the box'. Some issues are compiler related, and some
make use of things that Wine does not support yet and thus have to be
ifdef-ed out.

 * During that phase you will probably create a set of defines that have
to be there in order to get the MFC headers to compile. What I did is to
put them in afx.h, that way you don't need to copy them into each
application's makefile.

 * Once it compiles, comes the link and there again you'll probably have
to ifdef out some more. But overall not that much has to be disabled.
Although here I have a bit over 4000 lines of diffs (but that's also to
get rid of C++ errors and annoying warnings).

 * Then you can work on the application itself. At this point, make sure
winemaker generates a wrapper. It will do so automatically if it detects
the application as an MFC application or if you specify --mfc. The
wrapper is necessary to take care of initialization order issues.

 * One more tip: you can start with gcc 2.95, but to get an MFC
application that works and can use COM components, you'll need to use a
more recent gcc, one from CVS for instance. Then specify:
   -fms-extensions (helps get more stuff compiled)
   -fshort-wchar -DWINE_UNICODE_NATIVE (helps with Unicode support)
   -DICOM_USE_COM_INTERFACE_ATTRIBUTE  (to get the COM stuff working)


-- 
Francois Gouget
fgouget at codeweavers.com



More information about the wine-users mailing list