From 068bed6f12bdaf24b8bd9ead9557759c821f2cdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Tue, 8 Oct 2024 21:46:16 +0200 Subject: [PATCH] Convert make_fcontext etc into true C++ symbols --- include/boost/context/detail/fcontext.hpp | 9 +++---- src/posix/stack_traits.cpp | 30 +++++++++++++++++++++++ 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/include/boost/context/detail/fcontext.hpp b/include/boost/context/detail/fcontext.hpp index 00cb24d9..52be6083 100644 --- a/include/boost/context/detail/fcontext.hpp +++ b/include/boost/context/detail/fcontext.hpp @@ -27,14 +27,11 @@ struct transfer_t { void * data; }; -extern "C" BOOST_CONTEXT_DECL -transfer_t BOOST_CONTEXT_CALLDECL jump_fcontext( fcontext_t const to, void * vp); -extern "C" BOOST_CONTEXT_DECL -fcontext_t BOOST_CONTEXT_CALLDECL make_fcontext( void * sp, std::size_t size, void (* fn)( transfer_t) ); +BOOST_CONTEXT_DECL transfer_t jump_fcontext( fcontext_t const to, void * vp); +BOOST_CONTEXT_DECL fcontext_t make_fcontext( void * sp, std::size_t size, void (* fn)( transfer_t) ); // based on an idea of Giovanni Derreta -extern "C" BOOST_CONTEXT_DECL -transfer_t BOOST_CONTEXT_CALLDECL ontop_fcontext( fcontext_t const to, void * vp, transfer_t (* fn)( transfer_t) ); +BOOST_CONTEXT_DECL transfer_t ontop_fcontext( fcontext_t const to, void * vp, transfer_t (* fn)( transfer_t) ); }}} diff --git a/src/posix/stack_traits.cpp b/src/posix/stack_traits.cpp index 99281bfc..ee63cf72 100644 --- a/src/posix/stack_traits.cpp +++ b/src/posix/stack_traits.cpp @@ -20,6 +20,7 @@ extern "C" { #include #include +#include #if !defined (SIGSTKSZ) # define SIGSTKSZ (32768) // 32kb minimum allowable stack @@ -35,6 +36,35 @@ extern "C" { # include BOOST_ABI_PREFIX #endif +extern "C" +boost::context::detail::transfer_t BOOST_CONTEXT_CALLDECL jump_fcontext( boost::context::detail::fcontext_t const to, void * vp); +extern "C" +boost::context::detail::fcontext_t BOOST_CONTEXT_CALLDECL make_fcontext( void * sp, std::size_t size, void (* fn)( boost::context::detail::transfer_t) ); + +// based on an idea of Giovanni Derreta +extern "C" +boost::context::detail::transfer_t BOOST_CONTEXT_CALLDECL ontop_fcontext( boost::context::detail::fcontext_t const to, void * vp, boost::context::detail::transfer_t (* fn)( boost::context::detail::transfer_t) ); + +namespace boost { +namespace context { +namespace detail { + +transfer_t jump_fcontext( fcontext_t const to, void * vp) +{ + return ::jump_fcontext(to, vp); +} + +fcontext_t make_fcontext( void * sp, std::size_t size, void (* fn)( transfer_t) ) +{ + return ::make_fcontext(sp, size, fn); +} + +transfer_t ontop_fcontext( fcontext_t const to, void * vp, transfer_t (* fn)( transfer_t) ) +{ + return ::ontop_fcontext(to, vp, fn); +} +}}} + namespace { std::size_t pagesize() BOOST_NOEXCEPT_OR_NOTHROW {