I'm currently trying to build an MFC based-applications using Winelib. I (almost) successfully compiled the MFC, and get an mfc.dll.so 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 libmfc.so, but by default we have a dll, so i just symlink it to mfc.dll.so - 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 winemaker - Even when using the wrapper, it crashes at startup when trying to load my application dll. - The backtrace is something like
dllname (from libmfc.so) operator new ... Init (from /gcc-3.2.1/libstdc++-v3/src/ios.cc:211) ___static_initialization_and_destruction_ ... _dl_open ... WinMain (from myapp.exe_wrapper.c:83) __wine_exe_main (from myapp.exe.spec.c:129) start_process call_on_thread_stack
- Winelib must have been initialized, but the problem stills here ? Any suggestion ? - I then tried to remove linking with libmfc.so but using only the mfc.dll.so (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 area.... Any advices are welcomed !
On December 2, 2002 10:04 am, Ronald MALLET wrote:
Cool! Shouldn't some of these be submitted as patches?
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
Maybe winemaker should be patched to not add them based on a switch (maybe determine default value based on compiler). BTW, do you _have_ to remove them, or it doesn't matter?
- I had to force winnt.h to use nameless struct and unions
What exatcly did you do for this one?
- I added #define EDEADLOCK EDEADLK in /wine/msvcrt/errno.h
Sounds like a patch would be in order, no?
- I linked _alloca() to alloca() function
Where? Again, maybe you should submit this one.
- There was a conflict on HKEY type between <afxres.h> and <wine/windef.h>
What did you do?
- Some little others syntax issues like: __try __expect, asm {},
unsigned short(x), (LPCTSTR)CString
I reckon these are mods to the MFC source, no?
Dimitrie O. Paun wrote:
The packing pragmas looks handled by gcc-3.2.1, so we may remove all modifications made by winemaker
Maybe winemaker should be patched to not add them based on a switch (maybe determine default value based on compiler). BTW, do you _have_ to remove them, or it doesn't matter?
It was just warning issues
I had to force winnt.h to use nameless struct and unions
What exatcly did you do for this one?
Comment out the section that defined NONAMELESSTRUCT and NONAMELESSUNION
- I added #define EDEADLOCK EDEADLK in /wine/msvcrt/errno.h
Sounds like a patch would be in order, no?
- I linked _alloca() to alloca() function
Where? Again, maybe you should submit this one.
- There was a conflict on HKEY type between <afxres.h> and <wine/windef.h>
What did you do?
remove one of them !
- Some little others syntax issues like: __try __expect, asm {},
unsigned short(x), (LPCTSTR)CString
I reckon these are mods to the MFC source, no?
yes !
On December 2, 2002 10:57 am, jaymz@free.fr wrote:
What exatcly did you do for this one?
Comment out the section that defined NONAMELESSTRUCT and NONAMELESSUNION
From the Makefile?
- There was a conflict on HKEY type between <afxres.h> and
<wine/windef.h>
What did you do?
remove one of them !
Maybe we can find a solution that doesn't require removing anything! :) It works on Windows, how do they do it?
- Some little others syntax issues like: __try __expect, asm {},
unsigned short(x), (LPCTSTR)CString
I reckon these are mods to the MFC source, no?
yes !
I'd be curious to see the patch, if you can make it available, of course...