[fpc-pascal] Catching math exceptions in a DLL
obones at free.fr
Wed May 16 11:45:37 CEST 2012
Using FPC, I'm writing a DLL that exports functions used by a given host
In order to protect the host process, it is mandatory that all
exceptions are trapped in the exported function and in order to achieve
that, I have the following construct in all exported functions:
function SomeFunc(SomeParam: ParamType): Boolean;
Result := False;
// do the actual work
Result := True;
on E: TObject do
My problem comes when I have some code that does invalid math
operations, like division by zero for instance.
In that case, the raised exception is never caught by my except
statement and is directly sent to the host process, making it crash badly.
Is there a way to have ALL exceptions caught, regardless of their origin?
More information about the fpc-pascal