Winelib - MFC application

jaymz at jaymz at
Mon Dec 2 09:47:26 CST 2002

I'm currently trying to build an MFC based-applications using Winelib.
I (almost) successfully compiled the MFC, and get an file.

Here are the few troubles I had or still have:
First for compiling the MFC:
- I had to uncomment PSH_WIZARD97 in /wine/prsht.h
- The packing pragmas looks handled by gcc-3.2.1, so we may remove all
modifications made by winemaker
- I had to force winnt.h to use nameless struct and unions
- I added #define EDEADLOCK EDEADLK in /wine/msvcrt/errno.h
- I linked _alloca() to alloca() function
- There was a conflict on HKEY type between  <afxres.h> and <wine/windef.h>
- Some little others syntax issues like: __try __expect, asm {},
unsigned short(x), (LPCTSTR)CString
==> it worked then, using some additional defines as suggested in the
Winelib documentation page.

Then for my MFC-based application:
- Winemaker tries to link with, but by default we have a dll,
so i just symlink it to
- I first tried winemaker default settings on my app, but it creates two
targets with the same name (the dll and the executables), so I had to
override this using interactive mode
- Then I encountered the MFC initialization problems (a crash in
dllname() when loading my application .so), so I added the wrapper using
- Even when using the wrapper, it crashes at startup when trying to load
my application  dll.
- The backtrace is something like

     dllname (from
     operator new
     Init (from /gcc-3.2.1/libstdc++-v3/src/
     WinMain (from myapp.exe_wrapper.c:83)
     __wine_exe_main (from myapp.exe.spec.c:129)

- Winelib must have been initialized, but the problem stills here ? Any
suggestion ?
- I then tried to remove linking with but using only the  (I had to fill the mfc.dll.spec file to export all the
symbols, using weird mangling rules), but it then
hook in the msvcrt.dll in an infinite _lock loop ?

I'm a bit lost with this error, as it's not in an easy-to-debug code
Any advices are welcomed !

More information about the wine-devel mailing list