Subject: Re: Exception Handling under mingw32
From: [email-masked] (root)

25 Jun 1997 13:59:50 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Content-Type: text
Original-To: [email-masked] (Manmathan Muthukumarapillai)
Original-Cc: [email-masked]
In-Reply-To: <[email-masked]> from "Manmathan Muthukumarapillai" at Jun 25, 97 07:32:08 pm
Original-Sender: [email-masked]

> 
> Hello Everybody,
> 
> 1) VERY IMPORTANT
> Since Microsoft's Structured Exception Handling is not supported under
> mingw32 (gnu-win32), is there any other ways to do exception handling in
> this enviroment?

Easy:
You have to insert your exception handling routine at the linked list
of exception routines. Just insert it at fs:0, and in the 'next' field
put the old value in fs:0.

For the details see 'Microsoft Systems Journal', january I think. There
Matt pietreck explains how to do it.

> 
> 2) 
> Is it maybe possible to compile some C-code in which there is used
> Microsoft's Structured Exception Handling with MS's "CL" and then link
> it to gether with other objektfiles generated by gcc, ofcource I want to
> link the files together with ld/gcc and not with MS's LINK.EXE and not
> using Microsoft copyrighted libraryfiles.

You will have to write the exception handler catching routine. When an 
exception happens, the system goes into that list at fs:0, and will call
the routine you specified. Microsoft's one is called exception_handler3
(or something similar). If the code uses Microsoft's exception handler,
you will get an undefined reference to that routine.

Again, I recommend to all people interested to read Microsoft Systems
Journal. I hope I got the exact month OK, but I could be wrong by 
+ or - one month... typical programmer error!

> (The thing is that I want to distribute some librarys with objectfiles
> which the users (who do not have MS VC40) can use to link together with
> there own objectfiles)

To see an implementation of structured exception handler look at
the code
seh.c
in the lcc-win32 distribution. 
It is binary compatible with MSVC.

-- 
Jacob Navia	Logiciels/Informatique
41 rue Maurice Ravel			Tel 01 48.23.51.44
93430 Villetaneuse 			Fax 01 48.23.95.39
France
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".