diff --git a/include/boost/lexical_cast.hpp b/include/boost/lexical_cast.hpp index 0927e39..cd7d512 100644 --- a/include/boost/lexical_cast.hpp +++ b/include/boost/lexical_cast.hpp @@ -21,6 +21,32 @@ // Cheng Yang, Matthew Bradbury, David W. Birdsall and other Boosters // when: November 2000, March 2003, June 2005, June 2006, March 2011 - 2012 +#include +#if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_WSTRING) +#define BOOST_LCAST_NO_WCHAR_T +#endif + +#if (defined(__MINGW32__) || defined(__MINGW64__)) && (__GNUC__ == 4) \ + && ((__GNUC_MINOR__ == 4) || (__GNUC_MINOR__ == 5)) && defined(__STRICT_ANSI__) \ + && !defined(BOOST_LCAST_NO_WCHAR_T) + +// workaround for a mingw bug +// http://sourceforge.net/tracker/index.php?func=detail&aid=2373234&group_id=2435&atid=102435 +#include <_mingw.h> +#if (__GNUC_MINOR__ == 4) +extern "C" { +_CRTIMP int __cdecl swprintf(wchar_t * __restrict__ , const wchar_t * __restrict__ , ...); +_CRTIMP int __cdecl vswprintf(wchar_t * __restrict__ , const wchar_t * __restrict__ , ...); +} +#endif +#if (__GNUC_MINOR__ == 5) +extern "C" { +_CRTIMP int __cdecl swprintf(wchar_t * __restrict__ , const wchar_t * __restrict__ , ...); +_CRTIMP int __cdecl vswprintf(wchar_t * __restrict__ , const wchar_t * __restrict__ , va_list); +} +#endif +#endif + #include #include #include @@ -30,7 +56,6 @@ #include #include #include -#include #include #include #include @@ -67,10 +92,6 @@ #include #endif -#if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_WSTRING) -#define BOOST_LCAST_NO_WCHAR_T -#endif - #ifdef BOOST_NO_TYPEID #define BOOST_LCAST_THROW_BAD_CAST(S, T) throw_exception(bad_lexical_cast()) #else