[context/coroutine] DLL link errors in VS2015

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[context/coroutine] DLL link errors in VS2015

Boost - Users mailing list
I'm migrating some existing code that uses Boost.Coroutine from VS2013
to VS2015 and from Boost 1.55 to Boost 1.60.

(Minor aside: coroutine<T>::push_type had an empty() method in 1.55
which has vanished in 1.60.  This was mildly annoying but easily fixed
by using operator! instead.)

The code builds and runs fine as-is in VS2015 with Boost 1.60.  However
I wanted to try migrating to Boost.Coroutine2 as well, since Coroutine
is deprecated.  This however gives me the following errors:

t:\boost\boost_1_60_0\boost\context\execution_context.ipp(209): warning
C4251: 'boost::context::execution_context::ptr_': class
'boost::intrusive_ptr<boost::context::detail::activation_record>' needs
to have dll-interface to be used by clients of class
'boost::context::execution_context'
          t:\boost\boost_1_60_0\boost\context\execution_context.ipp(54):
note: see declaration of
'boost::intrusive_ptr<boost::context::detail::activation_record>'

error LNK2001: unresolved external symbol "public: static class
boost::intrusive_ptr<struct boost::context::detail::activation_record>
boost::context::detail::activation_record::current_rec"
(?current_rec@activation_record@detail@context@boost@@2V?$intrusive_ptr@Uactivation_record@detail@context@boost@@@4@A)

I'm building with BOOST_ALL_DYN_LINK, in case that makes a difference.

Is this a known issue?  Is it fixed in a later Boost release?

(FWIW, Boost.Coroutine also generates C4251 with a different symbol but
does not generate LNK2001, so the application still works.)

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [context/coroutine] DLL link errors in VS2015

Boost - Users mailing list
At the moment I've no Windows system to test it, but the error might be caused by a missing export statement.

In execution_context_v1.hpp change the code to:

struct BOOST_CONTEXT_DECL activation_record ...
struct BOOST_CONTEXT_DECL activation_record_initializer ...

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [context/coroutine] DLL link errors in VS2015

Boost - Users mailing list
On 22/02/2017 21:05, Oliver Kowalke via Boost-users wrote:
> At the moment I've no Windows system to test it, but the error might be
> caused by a missing export statement.
>
> In execution_context_v1.hpp change the code to:
>
> struct BOOST_CONTEXT_DECL activation_record ...
> struct BOOST_CONTEXT_DECL activation_record_initializer ...

Boost 1.60 doesn't have that file.  But making those changes in
execution_context.ipp causes the errors mentioned in
https://svn.boost.org/trac/boost/ticket/11365 ie. being incompatible
with thread_local (thread locals need to be behind a pimpl wall; they
can't be exported directly).

I'm about to try updating to 1.63 anyway, so we'll see how that goes, I
guess.


_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [context/coroutine] DLL link errors in VS2015

Boost - Users mailing list
On 23/02/2017 14:18, I wrote:

> On 22/02/2017 21:05, Oliver Kowalke wrote:
>> At the moment I've no Windows system to test it, but the error might be
>> caused by a missing export statement.
>>
>> In execution_context_v1.hpp change the code to:
>>
>> struct BOOST_CONTEXT_DECL activation_record ...
>> struct BOOST_CONTEXT_DECL activation_record_initializer ...
>
> Boost 1.60 doesn't have that file.  But making those changes in
> execution_context.ipp causes the errors mentioned in
> https://svn.boost.org/trac/boost/ticket/11365 ie. being incompatible
> with thread_local (thread locals need to be behind a pimpl wall; they
> can't be exported directly).
>
> I'm about to try updating to 1.63 anyway, so we'll see how that goes, I
> guess.

Good news: looks like this isn't an issue any more with Boost 1.63.  My
apologies for the noise.


_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [context/coroutine] DLL link errors in VS2015

Boost - Users mailing list
On 24/02/2017 14:20, I wrote:

> On 23/02/2017 14:18, I wrote:
>> On 22/02/2017 21:05, Oliver Kowalke wrote:
>>> At the moment I've no Windows system to test it, but the error might be
>>> caused by a missing export statement.
>>>
>>> In execution_context_v1.hpp change the code to:
>>>
>>> struct BOOST_CONTEXT_DECL activation_record ...
>>> struct BOOST_CONTEXT_DECL activation_record_initializer ...
>>
>> Boost 1.60 doesn't have that file.  But making those changes in
>> execution_context.ipp causes the errors mentioned in
>> https://svn.boost.org/trac/boost/ticket/11365 ie. being incompatible
>> with thread_local (thread locals need to be behind a pimpl wall; they
>> can't be exported directly).
>>
>> I'm about to try updating to 1.63 anyway, so we'll see how that goes, I
>> guess.
>
> Good news: looks like this isn't an issue any more with Boost 1.63.  My
> apologies for the noise.

Although now I have a related-but-different problem.

        typedef boost::coroutines2::coroutine<void>::push_type coroutine;

         std::vector<coroutine> coros;
         coros.emplace_back(std::bind(std::forward<F>(f), i,
std::placeholders::_1));
         // where f is a template functor&& and i is a template iterator

This code compiles fine in:
   - VS2013 (Windows, Boost 1.55, coroutines1)
   - VS2015 (Windows, Boost 1.55, coroutines1)
   - GCC 4.8.2 (Linux, Boost 1.55, coroutines1)
   - VS2015 (Windows, Boost 1.63, coroutines1 & coroutines2)
   - GCC 4.8.2 (Linux, Boost 1.63, coroutines1)

But using GCC with Boost 1.63 and coroutines2 I get some quite verbose
errors that I'm having trouble making sense of.  (Clang 3.4 gives a
similar error.)  Is this a bug or am I doing something weird?

/mnt/ThirdParty/boost/boost_1_63_0/include/boost/context/execution_context_v2_void.ipp:55:99:
error: no matching function for call to
'apply(std::decay<std::_Bind<boost::coroutines2::detail::push_coroutine<void>::control_block::control_block(boost::context::preallocated,
StackAllocator, Fn&&) [with StackAllocator =
boost::context::basic_fixedsize_stack<boost::context::stack_traits>; Fn
=
std::_Bind<{anonymous}::Test::Method()::__lambda8(std::reference_wrapper<std::pair<const
{anonymous}::Address, std::vector<{anonymous}::Data> > >,
std::_Placeholder<1>)>]::__lambda7(std::_Bind<{anonymous}::Test::Method()::__lambda8(std::reference_wrapper<std::pair<const
{anonymous}::Address, std::vector<{anonymous}::Data> > >,
std::_Placeholder<1>)>, std::_Placeholder<1>)> >::type&,
std::__tuple_cat_result<std::tuple<>&,
std::tuple<boost::context::execution_context<void>&&> >::__type)'
          Ctx cc = apply( fn_, std::tuple_cat( params_,
std::forward_as_tuple( std::move( from) ) ) );

 
                            ^
/mnt/ThirdParty/boost/boost_1_63_0/include/boost/context/execution_context_v2_void.ipp:55:99:
note: candidate is:
/mnt/ThirdParty/boost/boost_1_63_0/include/boost/context/detail/apply.hpp:54:1:
note: template<class Fn, class Tpl> decltype
(boost::context::detail::apply_impl(forward<Fn>(fn), forward<Tpl>(tpl),
boost::context::detail::make_index_sequence<std::tuple_size<typename
std::decay<_Tp2>::type>::value>{})) boost::context::detail::apply(Fn&&,
Tpl&&)
  apply( Fn && fn, Tpl && tpl)

  ^
/mnt/ThirdParty/boost/boost_1_63_0/include/boost/context/detail/apply.hpp:54:1:
note:   template argument deduction/substitution failed:
/mnt/ThirdParty/boost/boost_1_63_0/include/boost/context/detail/apply.hpp:
In substitution of 'template<class Fn, class Tpl> decltype
(boost::context::detail::apply_impl(forward<Fn>(fn), forward<Tpl>(tpl),
boost::context::detail::make_index_sequence<std::tuple_size<typename
std::decay<_Tp2>::type>::value>{})) boost::context::detail::apply(Fn&&,
Tpl&&) [with Fn =
std::_Bind<boost::coroutines2::detail::push_coroutine<void>::control_block::control_block(boost::context::preallocated,
StackAllocator, Fn&&) [with StackAllocator =
boost::context::basic_fixedsize_stack<boost::context::stack_traits>; Fn
=
std::_Bind<{anonymous}::Test::Method()::__lambda8(std::reference_wrapper<std::pair<const
{anonymous}::Address, std::vector<{anonymous}::Data> > >,
std::_Placeholder<1>)>]::__lambda7(std::_Bind<{anonymous}::Test::Method()::__lambda8(std::reference_wrapper<std::pair<const
{anonymous}::Address, std::vector<{anonymous}::Data> > >,
std::_Placeholder<1>)>, std::_Placeholder<1>)>&; Tpl =
std::tuple<boost::context::execution_context<void>&&>]':
/mnt/ThirdParty/boost/boost_1_63_0/include/boost/context/execution_context_v2_void.ipp:55:99:
   required from 'boost::context::detail::transfer_t
boost::context::detail::record_void<Ctx, StackAlloc, Fn,
Params>::run(boost::context::detail::transfer_t) [with Ctx =
boost::context::execution_context<void>; StackAlloc =
boost::context::basic_fixedsize_stack<boost::context::stack_traits>; Fn
=
std::_Bind<boost::coroutines2::detail::push_coroutine<void>::control_block::control_block(boost::context::preallocated,
StackAllocator, Fn&&) [with StackAllocator =
boost::context::basic_fixedsize_stack<boost::context::stack_traits>; Fn
=
std::_Bind<{anonymous}::Test::Method()::__lambda8(std::reference_wrapper<std::pair<const
{anonymous}::Address, std::vector<{anonymous}::Data> > >,
std::_Placeholder<1>)>]::__lambda7(std::_Bind<{anonymous}::Test::Method()::__lambda8(std::reference_wrapper<std::pair<const
{anonymous}::Address, std::vector<{anonymous}::Data> > >,
std::_Placeholder<1>)>, std::_Placeholder<1>)>; Params = {}]'


_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [context/coroutine] DLL link errors in VS2015

Boost - Users mailing list
Please try to use the boost.context code from branch develop (github) - I think it is related to see #41 (boost.context)

2017-02-24 7:19 GMT+01:00 Gavin Lambert via Boost-users <[hidden email]>:
On 24/02/2017 14:20, I wrote:
On 23/02/2017 14:18, I wrote:
On 22/02/2017 21:05, Oliver Kowalke wrote:
At the moment I've no Windows system to test it, but the error might be
caused by a missing export statement.

In execution_context_v1.hpp change the code to:

struct BOOST_CONTEXT_DECL activation_record ...
struct BOOST_CONTEXT_DECL activation_record_initializer ...

Boost 1.60 doesn't have that file.  But making those changes in
execution_context.ipp causes the errors mentioned in
https://svn.boost.org/trac/boost/ticket/11365 ie. being incompatible
with thread_local (thread locals need to be behind a pimpl wall; they
can't be exported directly).

I'm about to try updating to 1.63 anyway, so we'll see how that goes, I
guess.

Good news: looks like this isn't an issue any more with Boost 1.63.  My
apologies for the noise.

Although now I have a related-but-different problem.

        typedef boost::coroutines2::coroutine<void>::push_type coroutine;

        std::vector<coroutine> coros;
        coros.emplace_back(std::bind(std::forward<F>(f), i, std::placeholders::_1));
        // where f is a template functor&& and i is a template iterator

This code compiles fine in:
  - VS2013 (Windows, Boost 1.55, coroutines1)
  - VS2015 (Windows, Boost 1.55, coroutines1)
  - GCC 4.8.2 (Linux, Boost 1.55, coroutines1)
  - VS2015 (Windows, Boost 1.63, coroutines1 & coroutines2)
  - GCC 4.8.2 (Linux, Boost 1.63, coroutines1)

But using GCC with Boost 1.63 and coroutines2 I get some quite verbose errors that I'm having trouble making sense of.  (Clang 3.4 gives a similar error.)  Is this a bug or am I doing something weird?

/mnt/ThirdParty/boost/boost_1_63_0/include/boost/context/execution_context_v2_void.ipp:55:99: error: no matching function for call to 'apply(std::decay<std::_Bind<boost::coroutines2::detail::push_coroutine<void>::control_block::control_block(boost::context::preallocated, StackAllocator, Fn&&) [with StackAllocator = boost::context::basic_fixedsize_stack<boost::context::stack_traits>; Fn = std::_Bind<{anonymous}::Test::Method()::__lambda8(std::reference_wrapper<std::pair<const {anonymous}::Address, std::vector<{anonymous}::Data> > >, std::_Placeholder<1>)>]::__lambda7(std::_Bind<{anonymous}::Test::Method()::__lambda8(std::reference_wrapper<std::pair<const {anonymous}::Address, std::vector<{anonymous}::Data> > >, std::_Placeholder<1>)>, std::_Placeholder<1>)> >::type&, std::__tuple_cat_result<std::tuple<>&, std::tuple<boost::context::execution_context<void>&&> >::__type)'
         Ctx cc = apply( fn_, std::tuple_cat( params_, std::forward_as_tuple( std::move( from) ) ) );


                           ^
/mnt/ThirdParty/boost/boost_1_63_0/include/boost/context/execution_context_v2_void.ipp:55:99: note: candidate is:
/mnt/ThirdParty/boost/boost_1_63_0/include/boost/context/detail/apply.hpp:54:1: note: template<class Fn, class Tpl> decltype (boost::context::detail::apply_impl(forward<Fn>(fn), forward<Tpl>(tpl), boost::context::detail::make_index_sequence<std::tuple_size<typename std::decay<_Tp2>::type>::value>{})) boost::context::detail::apply(Fn&&, Tpl&&)
 apply( Fn && fn, Tpl && tpl)

 ^
/mnt/ThirdParty/boost/boost_1_63_0/include/boost/context/detail/apply.hpp:54:1: note:   template argument deduction/substitution failed:
/mnt/ThirdParty/boost/boost_1_63_0/include/boost/context/detail/apply.hpp: In substitution of 'template<class Fn, class Tpl> decltype (boost::context::detail::apply_impl(forward<Fn>(fn), forward<Tpl>(tpl), boost::context::detail::make_index_sequence<std::tuple_size<typename std::decay<_Tp2>::type>::value>{})) boost::context::detail::apply(Fn&&, Tpl&&) [with Fn = std::_Bind<boost::coroutines2::detail::push_coroutine<void>::control_block::control_block(boost::context::preallocated, StackAllocator, Fn&&) [with StackAllocator = boost::context::basic_fixedsize_stack<boost::context::stack_traits>; Fn = std::_Bind<{anonymous}::Test::Method()::__lambda8(std::reference_wrapper<std::pair<const {anonymous}::Address, std::vector<{anonymous}::Data> > >, std::_Placeholder<1>)>]::__lambda7(std::_Bind<{anonymous}::Test::Method()::__lambda8(std::reference_wrapper<std::pair<const {anonymous}::Address, std::vector<{anonymous}::Data> > >, std::_Placeholder<1>)>, std::_Placeholder<1>)>&; Tpl = std::tuple<boost::context::execution_context<void>&&>]':
/mnt/ThirdParty/boost/boost_1_63_0/include/boost/context/execution_context_v2_void.ipp:55:99:   required from 'boost::context::detail::transfer_t boost::context::detail::record_void<Ctx, StackAlloc, Fn, Params>::run(boost::context::detail::transfer_t) [with Ctx = boost::context::execution_context<void>; StackAlloc = boost::context::basic_fixedsize_stack<boost::context::stack_traits>; Fn = std::_Bind<boost::coroutines2::detail::push_coroutine<void>::control_block::control_block(boost::context::preallocated, StackAllocator, Fn&&) [with StackAllocator = boost::context::basic_fixedsize_stack<boost::context::stack_traits>; Fn = std::_Bind<{anonymous}::Test::Method()::__lambda8(std::reference_wrapper<std::pair<const {anonymous}::Address, std::vector<{anonymous}::Data> > >, std::_Placeholder<1>)>]::__lambda7(std::_Bind<{anonymous}::Test::Method()::__lambda8(std::reference_wrapper<std::pair<const {anonymous}::Address, std::vector<{anonymous}::Data> > >, std::_Placeholder<1>)>, std::_Placeholder<1>)>; Params = {}]'



_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [context/coroutine] DLL link errors in VS2015

Boost - Users mailing list
On 24/02/2017 19:48, Oliver Kowalke via Boost-users wrote:
> Please try to use the boost.context code from branch develop (github) -
> I think it is related to see #41 (boost.context)

What were the actual code changes related to that issue?  I don't see
anything linked.  Is it just header changes or will I have to rebuild
the library?

Also: commit b4e18ff60049 on context is going to cause problems, as
mentioned before: you can't export something that contains
thread-locals.  Whatever code was released in 1.63 seems fine and didn't
need changing, or at least did not generate any warnings/errors related
to exports.


_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users