title: error_category mismatch in asio when used across dlls
body: <p>I have a problem with handling <code>asio::error_code</code> values when they are received from another dll or executable. For instance, I may run an asynchronous operation with a handler:</p>
  <pre><code>socket.async_receive([](const asio::error_code&amp; errorCode)
  {
      if (errorCode == asio::error::operation_aborted)
         return;
  }
  </code></pre>
  <p>If the handler is created within a dll, and an <code>errorCode</code> is passed from another dll or executable, <code>operator==</code> would return false, since their <code>error_category</code> values differ. For example:</p>
  <pre><code>(gdb) info sym 0x55f1c0
  asio::system_category()::instance in section .data of C:\dev\builds\UWCASdk\Debug-MinGW-w64\Sandbox\ServerL410F\bin\sb.ServerL410F.exe
  (gdb) info sym 0x6f0420d0
  asio::system_category()::instance in section .data of C:\dev\builds\UWCASdk\Debug-MinGW-w64\Sandbox\ServerL410F\bin\libproviders.protobuf.client_d.dll
  </code></pre>
  <p>Clearly, these two instances are defined in different units and I basically have ODR violation.</p>
  <p><code>instance</code> is defined within <code>asio/impl/error_code.ipp</code>:</p>
  <pre><code>const error_category&amp; system_category()
  {
    static detail::system_category instance;
    return instance;
  }
  </code></pre>
  <p>ASIO documentation doesn't mention anything about <code>error_cateegory</code> when handling errors - it only specifies enum values, so using <code>errorCode.value == asio::error::operation_aborted</code> seems to be a valid workaround. But still this seems ugly.</p>
  <ul>
  <li>Is it somehow possible to compare errors across dlls as intended (with overloaded <code>operator==</code>)?</li>
  <li>Is it normal or expected to compare only <code>errorCode.value()</code> against enums?</li>
  </ul>