strange behaviour:
I have a DLL compiled with /EHa. Every DLL exported entry sets SEH translator, that throws C++ exception in some cases. Also I have EXE compiled with /EHs that calls DLL functions.
When I get SEH inside DLL C++ exception is thrown but application crashes with original SEH. I explored the problem and understood that:
- if C++ exception that is thrown from translator in /EHa module goes into /EHs module app crashes.
- if C++ exception that is thrown from translator in /EHa module is caught in /EHa module, everything works fine
- if C++ exception this is thrown form translator in /EHa module is caught in /EHa module but rethrown (by "throw;" ) then app also crashes.
I've found 2 working solutions:
- every module should be compiled with /EHa
- or /EHa module should not allow C++ exceptions thrown from translator leave the module or you can catch such exceptions and throw another (new!) C++ exception instead. Do not use "throw;".
I assume this is a bug (but I don't know where to report?). Tested in VS2008.