[fpc-pascal] Unhandled exception from library crashes host exe

OBones obones at free.fr
Wed Jun 27 16:14:17 CEST 2012


Hello,

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.
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

Regards




More information about the fpc-pascal mailing list