Click to See Complete Forum and Search --> : Converting from BC++ - mixed exception handling


Timothy Byrd
April 12th, 1999, 05:38 PM
I'm porting an application from Borland C++ to Visual C++ 6.0. There are dozens of places that use code similar to the following:

// These two defines are in a header
#define MY_TRY_SEH __try {
#define MY_CATCH_SEH } __except(MyExceptionFilter(GetExceptionCode())) { \
\ // Handle SEH exception
}

// Something like the following occurs in many, many places
void MyClass::MyFunc() {
// Do some stuff
try {
MY_TRY_SEH
// Do more stuff and call functions that may throw
// a C++ exception or a structured exception
MY_CATCH_SEH
}
catch(std::exception& message) {
// Handle exception
}
// Do some last stuff
}


While this works under BC++, Visual C++ does not allow mixing of SEH and C++ exception handling within a function. How can I massage the SEH macros so I don't have to rewrite large parts of the program?

-- Tim