[Mono-dev] Exception catching in C...

Gonzalo Paniagua Javier gonzalo at novell.com
Wed Jan 3 21:29:28 EST 2007


On Wed, 2007-01-03 at 10:38 +0100, Robert Jordan wrote:
> Thomas Wiest wrote:
> > Hey,
> > 	I'm embedding Mono and I'd like to know if there's a way for C to catch 
> > all unhandled exceptions. From this line on the interop page, it seems 
> > it is possible:
> > 
> > "It is very important that the unmanaged code not propagate any 
> > exceptions -- it must catch all exceptions, or else the unmanaged code 
> > calling the delegate will break."
> 
> This is a typo. The first "unmanaged" occurrence must be read as
> "managed".
> 
> > from: http://www.mono-project.com/Interop_with_Native_Libraries
> 
> It's not possible to catch a managed exception in unmanaged code
> when running on Unix.
> 
> On Windows, when using the VC compiler, you could set up a SEH
> exception handler.

You can still register your own function to deal with unhandled
exceptions by attaching a delegate to AppDomain.UnhandledException
handler (afair, for the root appdomain).

-Gonzalo





More information about the Mono-devel-list mailing list