
Le 20/01/12 08:42, Anthony Williams a écrit :
On 19/01/12 21:39, Vicente J. Botet Escriba wrote:
Le 19/01/12 13:12, Artyom Beilis a écrit :
----- Original Message -----
From: Anthony Williams<anthony.ajw@gmail.com> On 18/01/12 14:01, Vicente Botet wrote:
I was not aware that Boost.Thread was working as a header only library. This was a much-requested feature, so I made sure that boost::mutex at least was usable header-only.
Oh, I remember that now. So would this be fixed or I should switch to lightweight mutex?
As far as Boost.System is not-header-only we can not have both: boost::mutex header-only and compliant with c++11. As said before, I could let the user the possibility to set Boost.Thread to don't use Boost.System via BOOST_THREAD_DONT_USE_SYSTEM. Artyom, Anthony is this satisfactory for you?
That sounds reasonable to me: if people wish to use Boost.Thread header-only then they can define the macro, but anyone who needs to use the full features must link against the library, so can cope with the additional dependency on Boost.System.
It would be great if we could ensure that code with incompatible settings wouldn't link. We could mask out the parts of Boost.Thread that do need the library with that macro, for starters, so we don't need separate builds of the library with and without that macro.
Anthony Hi,
Ihave found that a little patch to Boost.System could make it header-only. It seems that Beman has already tried it, but there are some errors. Here it is the patch device3-1:trunk viboes$ svn diff boost/system libs/system Index: boost/system/error_code.hpp =================================================================== --- boost/system/error_code.hpp (revision 76354) +++ boost/system/error_code.hpp (working copy) @@ -504,7 +504,7 @@ #include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas -# ifdef BOOST_ERROR_CODE_HEADER_ONLY +# ifdef BOOST_SYSTEM_INLINED # include <boost/../libs/system/src/error_code.cpp> # endif Index: libs/system/src/error_code.cpp =================================================================== --- libs/system/src/error_code.cpp (revision 76354) +++ libs/system/src/error_code.cpp (working copy) @@ -407,20 +407,20 @@ { # ifndef BOOST_SYSTEM_NO_DEPRECATED - BOOST_SYSTEM_DECL error_code throws; // "throw on error" special error_code; + BOOST_SYSTEM_DECL BOOST_SYSTEM_INLINE error_code throws; // "throw on error" special error_code; // note that it doesn't matter if this // isn't initialized before use since // the only use is to take its // address for comparison purposes # endif - BOOST_SYSTEM_DECL const error_category & system_category() + BOOST_SYSTEM_DECL BOOST_SYSTEM_INLINE const error_category & system_category() { static const system_error_category system_category_const; return system_category_const; } - BOOST_SYSTEM_DECL const error_category & generic_category() + BOOST_SYSTEM_DECL BOOST_SYSTEM_INLINE const error_category & generic_category() { static const generic_error_category generic_category_const; return generic_category_const; Arytom, please could you try the patch to see if this could work for you (define BOOST_SYSTEM_INLINED)? If it is the case, we could see with Beman if he can apply the patch on trunk. Best, Vicente