Thank you all for your replies.

> Regular exceptions, those raised with the "raise" keyword are always trapped
> by try..except blocks but you have to make sure that EVERY method in the DLL
> that is called by the host exe has such a construct so as not to let the
> exception escape.

As I already mentioned this is not an option for me within my given
time frame. I am talking about an application with more than 20 dlls,
hundreds of thousands of lines of code and a heavy API between exe and
dlls based on interfaces. Even if I decided to bite the bullet and
-for instance- turn every interface method to "safecall" and add
"safecall" functionality in every object -I suppose that this would do
the trick- this would take a considerable amount of time, unacceptable
for production code that gets a release with new features every couple
of weeks.

> However, there are exceptions that come from the FPU and that arise when
> doing floating point maths. Those, in a DLL, are not trapped by the
> try..except blocks and are passed back to the host exe, effectively crashing
> them.
> If you want to trap them, you have to add a special unit in your DLL
> project, as explained in this issue:
>
> http://bugs.freepascal.org/view.php?id=12974
>
> Look for the last comment, it works fine here

I've read it and it seems to work for AVs and FPU exceptions only, not
for application-defined exceptions, is this correct? If so then it
will not be enough for me I'm afraid.

> That will not help. The problem described there appears only on Win64.
> Not on Windows 32 or linux.

Actually I am compiling with the 32bit version of FPC/Lazarus
producing 32bit images but running in a Windows 7 64-bit OS. I am not
sure if the problem appears in Win64 even with 32bit code. I can only
confirm that the situation is exactly the same in WinCE.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to