From: Danny S. <dan...@cl...> - 2005-12-18 05:32:38
|
----- Original Message ----- From: "Greg Chicares" Sent: Friday, 16 December 2005 22:20 > > void report_exception() { > try {throw;} > // Write these once and only once: > catch(exception_x&) {handle_exception_x();} > catch(exception_y&) {handle_exception_y();} > catch(...) {exit_carefully();} > } > > Applying this to an app that uses a dll, I stumbled across something: > > *** report_exception() mustn't be called across a dll boundary *** > > Exceptions can be thrown and caught across a dll boundary, > but this function abends if invoked across that boundary. > > I don't know whether that's obvious, or peculiar, or a defect. > > Here's a testsuite (190 lines, so I won't copy it here): > Hello Greg, Thanks for the report and especially for the testcase. Two ways to fix this: (1) Extend the global shared_ptr stucture to handle the __cxa_eh_globals defined in libsupc++ (This also fixes the bug reported here: http://sourceforge.net/mailarchive/forum.php?thread_id=7719655&forum_id=5119 (2) Build and use libstdc++ ( the libsupc++ components need to be shared) and libgcc as dlls Both solutions create ABI compatibility problems. I believe (2) would be easier to maintain in the long run, but there are some problems with import of vtables for type_info objects generated by compiler. (1) gets me following now. Should patch go into 3.4.5?: test_a_aa Rethrowing in app Caught in app: Exception from app. test_a_da Rethrowing in app Caught in app: Exception from dll. test_a_ad This will fail... Rethrowing in dll Caught in dll: Exception from app. SURPRISE: this line was reached. test_a_dd This will fail... Rethrowing in dll Caught in dll: Exception from dll. SURPRISE: this line was reached. test_d_aa This will fail... Rethrowing in app Caught in app: Exception from app. SURPRISE: this line was reached. test_d_da This will fail... Rethrowing in app Caught in app: Exception from dll. SURPRISE: this line was reached. test_d_ad Rethrowing in dll Caught in dll: Exception from app. test_d_dd Rethrowing in dll Caught in dll: Exception from dll. Danny |