I know, that there are lot of similar questions at Stackoverflow. But none of answers can solve my problem.
I am creating DLL which exports some functions this way:
extern "C" __declspec(dllexport) int init() { ... }
I use MinGW 4.4 on Windows XP. There are exceptions in init(), because I use Apache Thrift, and there is code like ttransport->open(), where ttransport is boost::shared_ptr<TTransport>, and TTransport -- Apache Thrift's class. There are possible situations when ttransport->open() throws TTransportException exception (TTransportException inherited from std::exception).
That exception crashes host-program where my DLL is loaded. Host program was written by 3rd person and I have no code of host-program.
Thus, I'm wandering, why wrapper-approaches like this can't help (host program crashes the same way):
try
{
    ttransport->open();        
}
// or just catch(...)
catch (std::exception &e) // or, using TTransportException
{
    return 42;
}
Can someone say what am I doing wrong?
Exceptions are not mine -- all was written in Apache Thrifts library, so I have no choice.