From 3704b9c59525dffe91acec6d7d69932bee9b6405 Mon Sep 17 00:00:00 2001 From: John Maddock Date: Mon, 28 Apr 2008 11:07:14 +0000 Subject: [PATCH] Fixes for issue #1871 that prevents duplicate symbol errors with VC++ compilers, when building with /Zc:wchar_t-. [SVN r44842] --- src/usinstances.cpp | 3 +++ src/wc_regex_traits.cpp | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/usinstances.cpp b/src/usinstances.cpp index 337d815f..d9f600dc 100644 --- a/src/usinstances.cpp +++ b/src/usinstances.cpp @@ -49,6 +49,9 @@ template _CRTIMP2 bool __cdecl operator>( #if BOOST_WORKAROUND(BOOST_MSVC, > 1300) && BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) template<> _CRTIMP2 std::size_t __cdecl char_traits::length(unsigned short const*); #endif +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +template _CRTIMP2 allocator::allocator(); +#endif } #endif diff --git a/src/wc_regex_traits.cpp b/src/wc_regex_traits.cpp index 9daf0804..29a77e15 100644 --- a/src/wc_regex_traits.cpp +++ b/src/wc_regex_traits.cpp @@ -19,9 +19,40 @@ #define BOOST_REGEX_SOURCE -#include +#include #include +#ifdef _DLL_CPPLIB +// +// This is a horrible workaround, without declaring these symbols extern we get +// duplicate symbol errors when linking if the application is built without +// /Zc:wchar_t +// +namespace std{ +template _CRTIMP2 bool __cdecl operator==( + const basic_string, allocator >&, + const basic_string, allocator >&); +template _CRTIMP2 bool __cdecl operator==( + const unsigned short *, + const basic_string, allocator >&); +template _CRTIMP2 bool __cdecl operator==( + const basic_string, allocator >&, + const unsigned short *); +template _CRTIMP2 bool __cdecl operator<( + const basic_string, allocator >&, + const basic_string, allocator >&); +template _CRTIMP2 bool __cdecl operator>( + const basic_string, allocator >&, + const basic_string, allocator >&); +#if BOOST_WORKAROUND(BOOST_MSVC, > 1300) && BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1400)) +template<> _CRTIMP2 std::size_t __cdecl char_traits::length(unsigned short const*); +#endif +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +template _CRTIMP2 allocator::allocator(); +#endif +} +#endif + #if !BOOST_WORKAROUND(__BORLANDC__, < 0x560) #include