title: How to correctly mix debug and release binaries involving std::string among others?
body: <p>I have a c++ project, I want to use it with debug binary, but I also want to use its dependencies no in debug but release.</p>
  
  <p>The problem is that is does not seem possible, in particular when I have <code>std::string &amp; var</code> as function arguments, I got memory errors such as:
  <code>Microsoft C++ exception: std::length_error at memory location 0x000000F2111AEE20</code> when attempting to access to string.</p>
  
  <p>In certain conditions, asking the compiler not to do any inlining helps, but sometimes for specific data (images), it's not sufficient.</p>
  
  <p>How to achieve this ie., having a debug project using release libraries, without rewriting dependents or libraries ? (I want to keep using <code>string</code>, and not <code>char*</code> or so).</p>
  
  <hr>
  
  <p>Repro: use toolset v141 of VS2017 or VS2019. Use OpenImageIO in release, and project in debug.</p>
  
  <pre><code>#include &lt;OpenImageIO/imageio.h&gt;
  
  int main()
  {
      auto in = ImageInput::open("SomeImageFile.DPX"); // std::length_error 
      if (in) {
          printf ("Opened successfully, format is %s\n", in-&gt;format_name());
      } else {
          printf ("Fail\n");
          return 1;
      }
      return 0;
  }
  </code></pre>
  
  <p>Library OpenImageIO source: <a href="https://github.com/OpenImageIO/oiio" rel="nofollow noreferrer">https://github.com/OpenImageIO/oiio</a></p>
  
  <p>Image sample: <a href="https://1drv.ms/u/s!AlUmbfQiLoTZhFOpmgFMMVKtgCOk" rel="nofollow noreferrer">https://1drv.ms/u/s!AlUmbfQiLoTZhFOpmgFMMVKtgCOk</a></p>