|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r61510 - trunk/libs/random/src
From: steven_at_[hidden]
Date: 2010-04-23 13:22:40
Author: steven_watanabe
Date: 2010-04-23 13:22:39 EDT (Fri, 23 Apr 2010)
New Revision: 61510
URL: http://svn.boost.org/trac/boost/changeset/61510
Log:
Fix random_device on mingw
Text files modified:
trunk/libs/random/src/random_device.cpp | 26 ++++++++++++++++++++++++--
1 files changed, 24 insertions(+), 2 deletions(-)
Modified: trunk/libs/random/src/random_device.cpp
==============================================================================
--- trunk/libs/random/src/random_device.cpp (original)
+++ trunk/libs/random/src/random_device.cpp 2010-04-23 13:22:39 EDT (Fri, 23 Apr 2010)
@@ -31,7 +31,30 @@
#include <wincrypt.h>
#include <stdexcept> // std::invalid_argument
-#pragma comment(lib, "Advapi32.lib")
+#define BOOST_AUTO_LINK_NOMANGLE
+#define BOOST_LIB_NAME "Advapi32"
+#include <boost/config/auto_link.hpp>
+
+#ifdef __MINGW32__
+
+extern "C" {
+
+// mingw's wincrypt.h appears to be missing some things
+WINADVAPI
+BOOL
+WINAPI
+CryptEnumProvidersA(
+ DWORD dwIndex,
+ DWORD *pdwReserved,
+ DWORD dwFlags,
+ DWORD *pdwProvType,
+ LPSTR szProvName,
+ DWORD *pcbProvName
+ );
+
+}
+
+#endif
BOOST_RANDOM_DECL const char * const boost::random_device::default_token = MS_DEF_PROV_A;
@@ -77,7 +100,6 @@
private:
void error(const std::string & msg) {
- DWORD error_code = GetLastError();
char buf[80];
DWORD num = FormatMessageA(
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
Boost-Commit 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