Skip to content

Various improvements related to Boost ASIO integration#29

Open
chris-se wants to merge 5 commits into
hudson-trading:masterfrom
chris-se:boost-improvements
Open

Various improvements related to Boost ASIO integration#29
chris-se wants to merge 5 commits into
hudson-trading:masterfrom
chris-se:boost-improvements

Conversation

@chris-se

Copy link
Copy Markdown

There were a couple of issues in corral when using it with the newest Boost version:

  • Use of the deprecated boost::io_service (replacement: boost::io_context)
  • Use of the deprecated resolver::query (replacement: direct parameters for async_resolve)
  • Missing include for posix_time (not automatic in newer Boost versions)

Additionally, in specialized setups where bcp --namespace was used during the build of the Boost library, the specialization of boost::asio::async_result would fail to compile. An additional commit reworks the specialization so that it works in all cases.

Christian Seiler added 5 commits June 23, 2026 11:36
Boost's build system has an option to use bcp --namespace during
the build. This will create a copy of the boost sources, but replace
all the namespace declarations from 'namespace boost {' to a custom
namespace, and then add an inline alias namespace for 'boost'.

This mostly works (accessing e.g. boost::system), but when
specializing types within the boost namespace, one cannot use the
pattern

namespace boost {
template <>
struct specialized<::myns::mytype> { ... };
}

because 'namespace boost' is just an alias. However, it is possible
to rewrite this in the global namespace as

template <>
struct boost::specialized<myns::mytype> { ... };

and this will work with both the default boost installation and
with a custom namespace version thereof.

Signed-off-by: Christian Seiler <c.seiler@luxflux.de>
Newer boost versions don't automatically include the header
defining posix_time when including <boost/asio.hpp>, so include
that specific header manually.

Signed-off-by: Christian Seiler <c.seiler@luxflux.de>
io_service was deprecated in Boost 1.66.0 in favor of io_context, and
was finally removed in Boost 1.87.0. Since the minimum Boost version
supported by corral is 1.77.0 anyway, we can unconditionally use
io_context instead of io_service.

Signed-off-by: Christian Seiler <c.seiler@luxflux.de>
.async_resolve(query{host, service}, callback) was deprecated in
favor of .async_resolve(host, service, callback), and the query
struct was removed in Boost 1.87.0.

Signed-off-by: Christian Seiler <c.seiler@luxflux.de>
If the test is compiled, link it against Boost, otherwise the test
source might not find the Boost headers if they are not installed
in a system-wide include directory.

Signed-off-by: Christian Seiler <c.seiler@luxflux.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant