discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: _NSUncaughtExceptionHandler Windows question


From: Richard Frith-Macdonald
Subject: Re: _NSUncaughtExceptionHandler Windows question
Date: Fri, 09 Sep 2005 09:12:19 +0100

On 2005-09-09 07:10:40 +0100 Lloyd Dupont <lloyd@nova-mind.com> wrote:

In my .NET binding, I didn't 'hard-link' with gnustep-base.dll because my C++ binding didn't support ObjectiveC.
Instead I load everything dynamically.
I set-up the exception handler this way:
======
HINSTANCE _hLibGSBase = LoadGSLib("gnustep-base.dll");
void** p_err_h = (void**) GetProcAddress(_hLibGSBase, "_NSUncaughtExceptionHandler");
if( !p_err_h )
   throw gcnew ObjectiveCException("Cannot set NSException Handler");
*p_err_h = &UnhandledObjectiveCExceptionHandler;
======
Where UnhandledObjectiveCExceptionHandler is an exception handler.

Anyway it seems to work and is sometimes called.
But due to weird behavior with one of our customer I tryed the following:
NSException *ex = [NSException exceptionWithName:@"aName" reason:@"aReason" userInfo:nil];
[ex raise];

And this pops-up a GNUstep error window, then anort the process and my error handler was never called.

Any reason why?
Any thoughts?

I can see only three possibilities ...
1. Your code to set the handler didn't get called
2. Something overwrote the address with zero after you set it.
3. Linker problem such that you had more than one copy of the library loaded so that the address looked at by the exception raising code was not the same as the address you set your handler in. On unix this can happen where there are both debug and non-debug versions of the library installed on the system, but I don't know if it's possible in windows too.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]