Boost logo

Boost :

From: Stuart Dootson (stuart.dootson_at_[hidden])
Date: 2005-08-24 02:21:56


On 8/24/05, Vladimir Prus <ghost_at_[hidden]> wrote:
> Luke Elliott wrote:
>
> >
> > (BTW - I just used program_options as an example as that's what I was
> > looking at at the time...)
> >
> > I don't have access to VC++ right now so this is from memory, but there
> > are (at least) 2 cases where it raises a warning:
> >
> > class MY_LIB_DECL my_class : public some_base
> > {
> > my_class();
> > };
> >
> > if some_base isn't a declspeced class then you get "warning non
> > dll-interface class used as based for dll-interface class".
>
> I believe this sometime happen when inheriting boost::noncopyable, that has
> no method to begin with, right? Then it's indeed poor compiler diagnostic,
> and we probably can add declspec, but I don't yet understand when it should
> be dllexport and when dllimport :-/
>

It's dependent on the users context. The easiest solution would be to
have some macro (BOOST_CLASS_LINKAGE or something?) normally declared
as empty:

   #define BOOST_CLASS_LINKAGE

   class BOOST_CLASS_LINKAGE noncopyable
   { <definition> };

If you need to dllexport a Boost class, redefine BOOST_CLASS_LINKAGE
appropriately:

   #undef BOOST_CLASS_LINKAGE
   #define BOOST_CLASS_LINKAGE __declspec(dllexport)

Having said that, my normal approach is #pragma warning(disable : 4275)...

<snip>

>
> - Volodya
>

Stuart Dootson


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk