------- Comment #20 from dave dot korn dot cygwin at gmail dot com 2009-06-29 15:12 ------- I think the best solution to this problem is to enable libstdc++ as a DLL, and export _S_empty_rep from it. Then every C++ DLL and EXE will link against libstdc++ and they'll all import the exact same instance. Problem solved *and* we get to keep the optimisation. The more difficult problem of windows shared-libraries not allowing undefined references (and how this interacts with RTTI and COMDATs in particular) is a larger issue which will need to be tackled separately.
I'm about to test a patch based on this approach. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24196