Pregunta

If I know that a particular extern "C" function in my program (say, RaiseException) is the only function that raises SEH exceptions, and I want them converted to C++ exceptions, is there any way for me to "selectively enable" /EHa for that function, so that the exceptions get converted to CStructured_Exception without bloating or slowing down the rest of the program as normally caused by /EHa?

¿Fue útil?

Solución

There's obviously no compiler option to do that. Maybe:

void RaiseException() {
   __try {
      // do something that might throw here...
   }

   __except(EXCEPTION_EXECUTE_HANDLER) {   
      throw std::exception("structured exception");
   }
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top