


You can install vectored exception handler over the area that possible can throw exceptions, it will get you callback in case exception happens, and later you can remove this handler. It's a OS API, a bit uglier and slower (only when exception is thrown) - because it will get all exceptions (before SEH handlers) that are thrown, you need to filter only ones you are interested in. Here's the definitions: It's a bit tricky to use because it requires to write custom handler, but its possible.Īnother option is just to use vectored exception handler to catch exceptions. Though the handling syntax is a bit different, so you'll need to wrap this stuff in preprocessor ifdefs.

It installs SEH handler with a bit of inline assembly. But there is a small trick you can do - MinGW provides _try1 and _except1 macros which does almost same stuff as MSVC. This is for x86_64, no idea about SEH support with clang & 32-bit code. Clang supports SEH on Windows exactly same as MSVC.
