From: Stefan.Hoffmeister@Econos.de (Stefan Hoffmeister (TeamB)) Subject: Re: FPU Exception problems Date: 09 Jul 1999 00:00:00 GMT Message-ID: <37b0abbb.13145942@forums.inprise.com> Content-Transfer-Encoding: 7bit References: <8DFDAE10BJeffVegasimulationdy@forums.inprise.com> Organization: Econos Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: borland.public.delphi.basm : JeffVega@simulationdynamics.com (Jeff Vega) wrote: > 2) Their suggested solution is to pepper in code that would re-mask >the exceptions in various places. But where does Delphi change the control >word that I can block code around it in this way? The only place where you would *have* to do it would be when the DLL is loaded. Unfortunately, you cannot do this in Delphi 4. Essentially your only option is to * save FPU control word in Extend * LoadLibrary the Delphi DLL * restore FPU control word in Extend * call a procedure in the Delphi DLL that will Set8087CW(TheExtendControlWord) Once you have done that, there is NOTHING else you have to change, because Delphi uses the variable "Default8087CW" (which is set by Set8087CW) to manage the control in every other situation. As you observed already, unfortunately you'd still have to take into account the various FLDCW in SYSTEM that may cause the FPU exception to be triggered due to a change in the exception mask. The only feasible solution for that is to rebuild the complete Delphi runtime library, adding FNSAVE (to some location) change the control word, execute the _TRUNC (for instance) and FRSTOR back. The effect on performance is not really that nice... -- Stefan Hoffmeister (TeamB) http://www.econos.de/ Please do apply judgement when sending email.