title: Any improvements on the GCC/Windows DLLs/C++ STL front?
body: <p>Yesterday, I got bit by a rather annoying crash when using DLLs compiled with GCC under Cygwin. Basically, as soon as you run with a debugger, you may end up landing in a debugging trap caused by RtlFreeHeap() receiving an address to something it did not allocate.</p>
  
  <p>This is a <a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24196" rel="nofollow noreferrer">known bug with GCC 3.4</a> on Cygwin. The situation arises because the libstdc++ library includes a "clever" optimization for empty strings. I spare you the details (see the references throughout this post), but whenever you allocate memory in one DLL for an std::string object that "belongs" to another DLL, you end up giving one heap a chunk to free that came from another heap. Hence the <strong>SIGTRAP in RtlFreeHeap()</strong>.</p>
  
  <p>There are other problems reported when exceptions are thrown across DLL boundaries.</p>
  
  <p>This makes GCC 3.4 on Windows an unacceptable solution as soon as your project is based on DLLs and the STL. I have a few options to move past this option, many of which are very time-consuming and/or annoying:</p>
  
  <ul>
  <li>I can <a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24196#c11" rel="nofollow noreferrer">patch my libstdc++</a> or <a href="http://gcc.gnu.org/ml/libstdc++/2004-09/msg00232.html" rel="nofollow noreferrer">rebuild it with the --enable-fully-dynamic-string</a> configuration option</li>
  <li>I can use static libraries instead, which increases my link time</li>
  </ul>
  
  <p>I cannot (yet) switch to another compiler either, because of some other tools I'm using. The comments I find from some GCC people is that "it's almost never reported, so it's probably not a problem", which annoys me even more.</p>
  
  <p><strong>Does anyone have some news about this?</strong> I can't find any clear announcement that this has been fixed (the bug is still marked as "assigned"), except one comment on the <a href="http://www.gnuradio.org/trac/ticket/48" rel="nofollow noreferrer">GNU Radio bug tracker</a>.</p>
  
  <p>Thanks!</p>