Is it "legal" for C++ runtime to call terminate() when the C++ code is used inside some non-C++ program?
<p>In certain cases - especially when an exception escapes a destructor during stack unwinding - C++ runtime calls <code>terminate()</code> which must do something reasonable post-mortem and then exit the program. When a question "why so harsh" arises  the answer is usually "there's nothing more reasonable to do in such error situations". That sounds reasonable if the whole program is in C++.</p>

<p>Now what if the C++ code is in a library and the program that uses the library is not in C++? This happens quite often - for example I might have a native C++ COM component consumed by a .NET program. Once <code>terminate()</code> is called inside the component code the .NET program suddenly ends abnormally. The program author will first of all think "I don't care of C++, why the hell is this library make my program exit?"</p>

<p>How do I handle the latter scenario when developing libraries in C++? Is it reasonable that <code>terminate()</code> unexpectedly ends the program? Is there a better way to handle such situations?</p>
