Using GCC 4.8 64bit with SEH on Windows

classic Classic list List threaded Threaded
1 message Options
Ali
Reply | Threaded
Open this post in threaded view
|

Using GCC 4.8 64bit with SEH on Windows

Ali
I have searched on the forums and didn't find any information on how to enable Structured Exception Handling in GCC 4.8.2 64 bit.I am using windows 8.

Here is my code:
#include <iostream>
int main(){
try{
std::string *str=new std::string("hello");
str=0; //null is assigned intentionally so to check exception
std::cout<<str->size();//should generate exception instead of crashing
}
catch(std::exception ep){
std::cout<<"unhandled Exception caught";//never reaches here
}
}
The program is compiled simply as g++ -m64 test.cpp -o test.exe
The expected output of the above program is "Unhandled exception caught", but in actual it simply crashes which means the try catch clause is not working.
So is it that GCC 4.8 (64bit) doesn't support full SEH yet or there is something else I am missing.
Any help would be appreciated.