title: "Mixing a dll boost library with a static runtime is a really bad idea..."
body: <p>I have two projects in a Visual Studio solution. One builds a static LIB, the other builds a dynamic DLL. Both use static runtime linking (/MT and /MTd), and both use Boost. Boost was not my decision - I wanted to chuck it but I was overruled by committee.</p>
  
  <p>The LIB builds fine, but the DLL coughs up an error from auto_link.hpp (line 354): "Mixing a dll boost library with a static runtime is a really bad idea...".</p>
  
  <pre><code>#if (defined(_DLL) || defined(_RTLDLL)) &amp;&amp; defined(BOOST_DYN_LINK)
  #  define BOOST_LIB_PREFIX
  #elif defined(BOOST_DYN_LINK)
  #  error "Mixing a dll boost library with a static runtime is a really bad idea..."
  #else
  #  define BOOST_LIB_PREFIX "lib"
  #endif
  </code></pre>
  
  <p>I did not define BOOST_DYN_LINK. It seems Boost is making a leap that since I am building a DLL (_USRDLL and _WINDLL are defined), I must want dynamic runtime linking (/MD or /MDd, which defines _DLL) or DLL linking against Boost. This is incorrect as I specifically asked for static linking (/MT or /MTd).</p>
  
  <p>I filed a <a href="https://svn.boost.org/trac/boost/ticket/6644" rel="noreferrer">bug report</a> against Boost for its incorrect assumptions, but that does not help me with using the library. In the report, the Boost maintainers insist that I am setting it (despite the fact that an audit showed I am not; and Boost manipulates it in at least 30 files). I found <a href="http://lists.boost.org/Archives/boost/2006/04/103235.php" rel="noreferrer">one answer</a> on the Boost mailing list, which essentially states to change my project settings to accomodate Boost.</p>
  
  <p>Changing to Dynamic Runtime Linking (/MD and /MDd) is not feasible since static linking was chosen (1) due to security considerations, and (2) another library uses static linking. This is non-negotiable - we have no choice.</p>
  
  <p>To summarize for clarity (TLDR): I want to use static linking for everything, while my output program is a DLL (not a static LIB, not an EXE). Everything is linked statically within the DLL.</p>
  
  <p>Does anyone know how to use this library on Windows to build a DLL with static linking?</p>