|
Boost Users : |
Subject: Re: [Boost-users] Problems Linking with Boost Serialization
From: Isaac Lascasas (isaaclascasas_at_[hidden])
Date: 2014-09-24 09:59:49
I have found what I think is a problem with
basic_text_iprimitive/wiprimitive. When linking a windows clr dll (may
happen with other configurations too), if you use both serialization and
wserialization you should not be able to link because of a couple of
symbols defined across two different modules (is_whitespace(char) and
is_whitespace(wchar_t) in basic_text_iprimitive and basic_text_wiprimitive).
I solved the problem by changing this two files and rebuilding boost:
// basic_text_iprimitive.ipp:
template<>
bool is_whitespace(char t);
// {
// return 0 != std::isspace(t);
// }
#ifndef BOOST_NO_CWCHAR
template<>
bool is_whitespace(wchar_t t);
// {
// return 0 != std::iswspace(t);
// }
#endif
} // detail
// basic_text_iprimitive.cpp:
namespace detail {
template<class CharType>
bool is_whitespace(CharType c);
template<>
bool is_whitespace(char t)
{
return 0 != std::isspace(t);
}
#ifndef BOOST_NO_CWCHAR
template<>
bool is_whitespace(wchar_t t)
{
return 0 != std::iswspace(t);
}
#endif
} // detail
Regards.
2014-09-16 6:32 GMT+02:00 Isaac Lascasas <isaaclascasas_at_[hidden]>:
> I have found this on boost 1.56 with msvc12:
>
> Error 119 error LNK2005: "bool __cdecl
> boost::archive::detail::is_whitespace<char>(char)" (??$is_whitespace_at_D
> @detail_at_archive@boost@@YA_ND_at_Z) already defined in
> libboost_wserialization-vc120-mt-1_56.lib(basic_text_wiprimitive.obj)
> C:\supernova\sb6\src\supernova_clr\libboost_serialization-vc120-mt-1_56.lib(basic_text_iprimitive.obj)
> Error 120 error LNK2005: "bool __cdecl
> boost::archive::detail::is_whitespace<wchar_t>(wchar_t)" (??$is_whitespace@
> _W_at_detail@archive_at_boost@@YA_N_W_at_Z) already defined in
> libboost_wserialization-vc120-mt-1_56.lib(basic_text_wiprimitive.obj)
> C:\supernova\sb6\src\supernova_clr\libboost_serialization-vc120-mt-1_56.lib(basic_text_iprimitive.obj)
>
> This code used to link fine with previous boost versions. Now it looks
> like you can't use both archive and warchive at the same time. I'm using
> xml warchives for serializing in my code.
>
> Regards.
> Isaac Lascasas.
>
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net