Boost logo

Boost :

From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2008-07-01 08:35:53


Berserker wrote:
> In my project (using asio) I have something like this:
>
> void Foo::myCallback(const boost::system::error_code &e)
> {
> if(e == boost::asio::error::operation_aborted)
> {
> // bla bla...
> }
> }
>
> This call is made across a shared dll and I notice that for a "strange" reason e == boost::asio::error::operation_aborted was always false.
>
> I discover that when the temporary object boost::system::error_code is constructed from the constants boost::asio::error::operation_aborted the error_code's costructor take a pointer to a "error_category" and the comparison operator is (m_cat is an error_category pointer):
>
> inline friend bool operator==( const error_code & lhs, const error_code & rhs )
> {
> return lhs.m_cat == rhs.m_cat && lhs.m_val == rhs.m_val;
> }
>
> In my situation (using shared modules) lhs.m_cat == rhs.m_cat points to differents memory regions (even if are of the same type "system_category") because of the static initialization in the function "get_system_category".

Are you using the dll version of boost_system? You need to so that there
will only be one copy of the get_system_category function.

Cheers,
Chris

P.S. please don't mail to both lists separately -- it made your emails
get flagged as spam for me.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk