Hello all,
Using FPC, I'm writing a DLL that exports functions used by a given host process.
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;
begin
Result := False;
try
// do the actual work
Result := True;
except
on E: TObject do
NotifyException(E);
end;
end;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?
