Boost logo

Boost :

Subject: Re: [boost] UUID broken with Boost 1.67 and VS2015?
From: James E. King, III (jking_at_[hidden])
Date: 2018-04-23 19:03:31


On Mon, Apr 23, 2018 at 12:43 PM, Roger Leigh via Boost <
boost_at_[hidden]> wrote:

> In a source file including:
>
> #include <boost/uuid/uuid.hpp>
> #include <boost/uuid/uuid_io.hpp>
> #include <boost/uuid/uuid_generators.hpp>
>
> and then calling
>
> boost::uuids::to_string(boost::uuids::random_generator()())
>
> I'm getting:
>
> ome-filesd.lib(OMETIFFWriter.cpp.obj) : error LNK2019: unresolved
> external symbol BCryptCloseAlgorithmProvider referenced in function
> "public: __cdecl boost::uuids::detail::random_p
> rovider_base::~random_provider_base(void)" (??1random_provider_base_at_detai
> l_at_uuids@boost@@QEAA_at_XZ)
> ome-filesd.lib(OMETIFFWriter.cpp.obj) : error LNK2019: unresolved
> external symbol BCryptGenRandom referenced in function "public: void
> __cdecl boost::uuids::detail::random_provider_base::get_random_bytes(void
> *,unsigned __int64)" (?get_random_bytes_at_random_provider_base_at_detail
> @uuids_at_boost@@QEAAXPEAX_K_at_Z)
> ome-filesd.lib(OMETIFFWriter.cpp.obj) : error LNK2019: unresolved
> external symbol BCryptOpenAlgorithmProvider referenced in function "public:
> __cdecl boost::uuids::detail::random_provider_base::random_provider_base(void)"
> (??0random_provider_base_at_detail@uuids_at_boost@@QEAA_at_XZ)
> test\ome-files\ometiffwriter.exe : fatal error LNK1120: 3 unresolved
> externals
>
> Looking at boost/winapi/bcrypt.hpp from the 1.67.0 source tar.bz2, I see
> these symbols prototyped, but not defined anywhere. Is this header broken,
> missing the implementation?
>
>
> Thanks,
> Roger
>

As of 1.67.0, for uuid consumers, the default entropy provider on Windows
is bcrypt.
The bcrypt library is included automatically unless you are defining
BOOST_ALL_NO_LIB
or BOOST_UUID_RANDOM_PROVIDER_NO_LIB.
See:
https://github.com/boostorg/uuid/blob/develop/include/boost/uuid/detail/random_provider_bcrypt.ipp#L17

If you want to continue to use wincrypt then you can either define
BOOST_UUID_RANDOM_PROVIDER_FORCE_WINCRYPT
or set _WIN32_WINNT to something less than 0x0600.
The entropy provider logic happens at compile time.
See:
https://github.com/boostorg/uuid/blob/develop/include/boost/uuid/detail/random_provider_detect_platform.hpp#L28

Thanks,

Jim


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk