Boost logo

Boost Users :

From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2021-09-13 06:43:33


On 12/09/2021 9:26, John Emmas via Boost-users wrote:
> On 11/09/2021 14:59, John Emmas wrote:
>>
>> this seemingly minor change:-
>>
>>     #include <boost/intrusive/list.hpp>
>>     class __declspec(dllexport) Point : public
>> boost::intrusive::list_base_hook<> {
>> };
>>
>> will immediately invoke this compile-time assertion:-
>> "BOOST_STATIC_ASSERT(( (int)hooktags::link_mode == (int)auto_unlink
>> ));" - i.e. the message I reported earlier...
>>
>> So (presumably ?) 'boost::intrusive::list_base_hook<>' can't be used
>> in a class that'll get exported from a DLL?
>>
>
> Just wondering if anyone can reproduce this?  Today I've tried 3 x
> different revisions of libboost:- 1.77, 1.74 and 1.71 - but they all
> give me the same assertion message.  So maybe it's an intentional
> limitation?
>
> John

hi,

Sorry about being missing these days. When you declare something as
declspec the compiler must instantiate the class including all base
classes. A base hook has members that have only sense when some options
are used so the instantiation fails. To sum up: yes, boost.intrusive is
not prepared to be used in a DLL interface.

Best,

Ion


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net