Boost logo

Boost-Build :

Subject: Re: [Boost-build] Building and Installing Shared Boost Libraries on Windows
From: Andrey Sklyar (andrey_at_[hidden])
Date: 2016-02-08 05:05:14


Vladimir,

> It seems that when you're building your application, you are not
> requesting DLL linking. What's your
> command line? I think you need to have either /MD or /MDd option on the
> command line, or select same
> under VS project properties (C/C++ -> Code Generation -> Runtime Library)
>

The variable that needs to be defined is "BOOST_ALL_DYN_LINK". I
actually had /MDd already set. Thanks for pointing me on the right track.
Here's the resolution (the nesting represents an included file).

#include <boost/filesystem.hpp>

  # include <boost/filesystem/config.hpp>

    //
    // If we're importing code from a dll, then tell auto_link.hpp about it:
    //
    #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK)
    # define BOOST_DYN_LINK
    #endif
    //
    // And include the header that does the work:
    //
    #include <boost/config/auto_link.hpp>

      /*************************************************

      USAGE:
      ~~~~~~
      ...
      BOOST_DYN_LINK: Optional: when set link to dll rather than
static library.
      ...
      BOOST_LIB_PREFIX: "lib" for static libraries otherwise "".
      ...

      *************************************************/
      //
      // select linkage opt:
      //
      #if (defined(_DLL) || defined(_RTLDLL)) && 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

> Unlike other build systems, install is not special-cased in Boost.Build,
> so you can just specify desired properties
> when building the 'install' target, e.g.:
>
> .\b2 --build-dir=%BUILD_DIR% architecture=x86 address-model=64
> runtime-link=shared threading=multi link=shared variant=debug install
>

Great! Will give this a try.



Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk