Subject Delphi application and Firebird 2.5 client
Author Simon Benedicic
Hi all,

I have a Delphi database application that is currently running on FB 2.5 server. Application was working OK for several years on previous FB versions. I switched to FB 2.5 early when it was released.

This year I noticed a couple of cases when there was INF value written in double precision field in database. I also noticed, that Delphi Try / Except / End block was not catching EZeroDivide etc. exceptions ... this is big problem.
Imagine case like this:

var
A,B,C: Real;

try
C := A / B; // B is zero here
except
C := 0;
end

Exception is not raised on C calculation and C is calculated as INF.
Well I can change that and check if B is zero and do workaround, but there is Delphi VCL that depends on exception being raised!
That is why Delphi sets FPU Control Word to $1332 to raise exceptions.
You can read more about that here:
http://qc.embarcadero.com/wc/qcmain.aspx?d=5928

So, when I was looking for DLL that my application loads that disables FPU exceptions I realised that it is Firebird Client library or its MSVC RTL.

What I found out is that my delphi application is catching exceptions if I use FB client from version 1.5 up to version 2.1.4, but not with FB 2.5 client.

Now I wonder if it is FB Client that is builded with disabled FPU exceptions catching or is it MSVC RTL. I dont know if MSVC RTL changed from FB 2.1.4 to FB 2.5 or it is the same.

If I set FPU CW to $1332 manualy in my application it works only for a couple of lines of code than it is back disabled again, so this is not a solution. Currently I am using 2.1.4 client to be on the safe side.

Does anybody knows what changed in FB 2.5 and what can be done about it?


Thank you and best regards,

Simon