title: mixing code compiled with /MT and /MD
body: <p>I have a large body of code, compiled with /MT (i.e. expecting to statically link against the CRT). I need to combine this with a static third-party library, which has been built with /MD (i.e. expecting to link the CRT dynamically).</p>
  
  <p>Is it theoretically possible to link the two into one executable without recompiling either?</p>
  
  <p>If I link with /nodefaultlib:msvcrt, I end up with a small number of undefined references to things like <code>__imp__wgetenv</code>. I'm tempted to try implementing those functions in my own code, forwarding to <code>wgetenv</code>, etc. Is that worth trying, or will I run straight into the next problem?</p>
  
  <p>Unfortunately I'm Forbidden from taking the easy option of packing the thirdparty code into a separate DLL :-/</p>