When a program that has a TRESTClient
components is shutdown, it will show an "Abnormal Program Termination" error.
Recently, we've upgraded a project from C++Builder 2009 to C++Builder 10.2 Tokyo. Afterwards, we added the new TRESTClient
to our project. Now, every time we try to close the application, it shows this error. This means that an abort()
call is probably made.
We've run the debugger until the end of the tWinMain()
function, which shows that it happens after the return. This shows that the exception is thrown during application cleanup. In the included call stack, it shows Data::Bind::Objectscope::Finalization
, and UnregisterScope()
being called from there. This is most likely where the exception is thrown.
This problem seems very similar to the issue in this forum post. Remy Lebeau describes this as a bug where, if an item is not found while unregistering, an exception is thrown.
This is fixed as of 10.3.2: https://stackoverflow.com/a/56195297/6852057
To fix it in an older version:
The issue has to do with the link order of two libraries, namely "bindengine.lib" and "bindcomp.lib".
When "bindcomp.lib" is linked in BEFORE "bindengine.lib" you will see this problem, and for some frustrating reason the IDE insists in placing the them in wrong order. So to resolve the issue.