Question

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?

Was it helpful?

Solution

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");
   }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top