Hey the following patch eases cross compiling of the dlls that use exceptions, its possible to work around this with scripts of course but this makes it much cleaner to do so. I wasnt sure if it was appropriate to include such a modification in wine though.
This is based on what mingw does in its windef.h but I thought that excpt.h was more appropriate. See here for reference: http://cygwin.com/cgi-bin/cvsweb.cgi/src/winsup/w32api/include/windef.h?rev=...
With this patch the dlls that dont cross compile with wines headers are: dbghelp dnsapi gdi32 glu32 icmp iphlpapi kernel32 msvcrt ntdll opengl32 rpcrt4 secur32 shell32 winex11.drv wininet winmm ws2_32
Regards,
John Klehm
--- include/excpt.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/include/excpt.h b/include/excpt.h index 3369f3b..081fb06 100644 --- a/include/excpt.h +++ b/include/excpt.h @@ -46,6 +46,10 @@ typedef enum _EXCEPTION_DISPOSITION unsigned long __cdecl _exception_code(void); void * __cdecl _exception_info(void); int __cdecl _abnormal_termination(void); +#elif defined(__GNUC__) && defined(USE_COMPILER_EXCEPTIONS) +#define __try +#define __except(x) while(0) +#define __finally #endif /* defined(_MSC_VER) && defined(USE_COMPILER_EXCEPTIONS) */
#endif /* __WINE_EXCPT_H */ -- 1.5.4.5
John Klehm wrote:
diff --git a/include/excpt.h b/include/excpt.h index 3369f3b..081fb06 100644 --- a/include/excpt.h +++ b/include/excpt.h @@ -46,6 +46,10 @@ typedef enum _EXCEPTION_DISPOSITION unsigned long __cdecl _exception_code(void); void * __cdecl _exception_info(void); int __cdecl _abnormal_termination(void); +#elif defined(__GNUC__) && defined(USE_COMPILER_EXCEPTIONS) +#define __try +#define __except(x) while(0) +#define __finally #endif /* defined(_MSC_VER) && defined(USE_COMPILER_EXCEPTIONS) */
#endif /* __WINE_EXCPT_H */
Actually, I think the best place to fix this is in include/wine/exception.h. I also think it would be better to use "defined(__MINGW32__) && !defined(USE_COMPILER_EXCEPTIONS)." This is because that is the platform that can't use the exception macros implemented on top of sigsetjmp, and if the developer defines "USE_COMPILER_EXCEPTIONS" then it is telling us that their compiler supports __try, __except and __finally (there have been custom builds of MinGW that include support for native exception handling).
Robert Shearman rob@codeweavers.com writes:
Actually, I think the best place to fix this is in include/wine/exception.h. I also think it would be better to use "defined(__MINGW32__) && !defined(USE_COMPILER_EXCEPTIONS)." This is because that is the platform that can't use the exception macros implemented on top of sigsetjmp, and if the developer defines "USE_COMPILER_EXCEPTIONS" then it is telling us that their compiler supports __try, __except and __finally (there have been custom builds of MinGW that include support for native exception handling).
I don't think we want to disable exceptions, that will just lead to broken builds. It should be possible to make the sigsetjmp variant work for MinGW.
Alexandre Julliard wrote:
Robert Shearman rob@codeweavers.com writes:
Actually, I think the best place to fix this is in include/wine/exception.h. I also think it would be better to use "defined(__MINGW32__) && !defined(USE_COMPILER_EXCEPTIONS)." This is because that is the platform that can't use the exception macros implemented on top of sigsetjmp
I don't think we want to disable exceptions, that will just lead to broken builds. It should be possible to make the sigsetjmp variant work for MinGW.
You can make it compile by using sigjmp instead of sigsetjmp, but there's not much point because the code depends on Wine-only functions in ntdll that aren't available on Windows and so would cause the DLLs not to load.
Robert Shearman rob@codeweavers.com writes:
Alexandre Julliard wrote:
I don't think we want to disable exceptions, that will just lead to broken builds. It should be possible to make the sigsetjmp variant work for MinGW.
You can make it compile by using sigjmp instead of sigsetjmp, but there's not much point because the code depends on Wine-only functions in ntdll that aren't available on Windows and so would cause the DLLs not to load.
Yes, but the functions could be moved to winecrt0 or something like that and get statically linked into the dll.
Alexandre Julliard wrote:
Robert Shearman rob@codeweavers.com writes:
Alexandre Julliard wrote:
I don't think we want to disable exceptions, that will just lead to broken builds. It should be possible to make the sigsetjmp variant work for MinGW.
You can make it compile by using sigjmp instead of sigsetjmp, but there's not much point because the code depends on Wine-only functions in ntdll that aren't available on Windows and so would cause the DLLs not to load.
Yes, but the functions could be moved to winecrt0 or something like that and get statically linked into the dll.
In the past, I tried using our implementation of __wine_exception_handler on Windows, but it crashes in these three lines:
RtlUnwind( frame, 0, record, 0 ); __wine_pop_frame( frame ); siglongjmp( wine_frame->jmp, 1 );
The reason is that RtlUnwind clears all general purpose registers (and maybe changes esp/ebp) so that frame is no longer valid. There may be a way to work around this, but I'm not sure.
On Fri, Apr 4, 2008 at 8:35 AM, Robert Shearman rob@codeweavers.com wrote:
Alexandre Julliard wrote:
I don't think we want to disable exceptions, that will just lead to broken builds. It should be possible to make the sigsetjmp variant
work
The reason is that RtlUnwind clears all general purpose registers (and maybe changes esp/ebp) so that frame is no longer valid. There may be a way to work around this, but I'm not sure.
Well how about for the interim a no op patch. No op exceptions can be handled in the case: defined(__MINGW32__) && ! defined(USE_COMPILER_EXCEPTIONS).
The eventual support for compiler exceptions can then go in separate case: defined(__MINGW32__) && defined(USE_COMPILER_EXCEPTIONS)
Patch attached implementing Rob S suggestions.
--John