Faced the C library ( proj4 ), which, when initialized, generates itself NaN :
NaN = sqrt(-1.0); (see geodesic.c )
I use this library from Delphi and there from such a trick falls out the exception "Floating point invalid operation" .
With this exception, in principle, it is possible to fight, but the method is not thread-safe (the global variable Default8087CW used within the Delphi system libraries):
var VMask: TArithmeticExceptionMask; begin VMask := GetExceptionMask(); SetExceptionMask(VMask + [exInvalidOp]); try // вызов функции, которая бросает исключение finally SetExceptionMask(VMask); end; end; I collected this library ( proj.dll ) myself from sorts, in MSVC 2008, and maybe I didn’t correctly indicate any flags when compiling that affect forwarding of this exception?
Tell me, did anyone come across such a situation and how can it be dealt with normally in a multithreaded application.
Try.. Exceptand catch exactly this type of exception? So much for thread safety. - kamic, then how would it help you to ignore the exception already inDelphi, outside the interrupted code? You cannot restore the initialization anymore ... In this case, I do not understand the meaning of the code given by you in the question. - kamidllnot interrupted. This is not ignoring, but disabling an exception that is executed through the registers of the processor, and not just inDelphi. - zed