I have a C++ DLL with code like this:
LogMessage( "Hello world" );
try {
throw new int;
} catch( int* e ) {
LogMessage( "Caught exception" );
delete e;
}
LogMessage( "Done" );
This DLL is loaded by some third-party application and the code above is invoked. The problem is only the first LogMessage
is invoked - even though there's an exception handler the control flow is transferred to the unknown.
I see this and can't decide whether it's some obscure bug to be investigated or just the evil force of the consumer application.
Is it really possible for a consumer application to override the C++ exception handling in a DLL?
EDIT: The problem resolved after thinking on all things to check outlined in the answers. In real code it's not just throw, there'a a special function for throwing exceptions that has a call to MessageBoxW() Win32 call in debug version. And the consumer application had troubles showing the message box (it's an NT service) and effectively hung up. So it's not a problem of C++ exceptions handling in any way.