This will happen if your DLL has thrown exceptions from the exported functions. A DLL should not do this, so you need to catch all the exceptions at the border of your DLL and convert them to error code return values.
If you do not have control over the DLL, you will need to write a wrapper layer. Create another native DLL that calls the source DLL and catches all the exceptions that it throws. You could do this with another Delphi DLL, I suspect, or, alternatively, with a C or C ++ DLL that used SEH to catch exceptions.
It would be possible for a script to generate code for such a DLL wrapper. You would like to do this if there were many functions that you needed to wrap.
source share