Boost logo

Boost Users :

From: Conrad Weyns (weyns_at_[hidden])
Date: 2005-03-25 02:41:15


----- Original Message -----
From: "Klaus Nowikow" <nowikow_at_[hidden]>
To: <boost-users_at_[hidden]>
Sent: Thursday, March 24, 2005 11:23 AM
Subject: [Boost-users] [signals] Compiler warnings with BOOST_ALL_DYN_LINK

> Hello,
>
> I have a problem using Boost.Signals. With this test program:
>
> <code>
> // See the previous thread regarding
> // "[regex] Unresolved external symbols under VC7.1 w/ dynamic linking
> #define BOOST_ALL_DYN_LINK
> #include <boost/signals.hpp>
>
> int main(int argc, char* argv[])
> {
> return 0;
> }
> </code>
>
> I get some compiler warnings under MSVC 7.1 / Boost 1.32. Is there
> something I
> can do about it?
>
> Here is the compiler output I get:
>
> c:\dev\Libraries\Boost\include\boost-1_32\boost\signals\connection.hpp(111)
> :
> warning C4251: 'boost::signals::connection::con' : class
> 'boost::shared_ptr<T>'
> needs to have dll-interface to be used by clients of class
> 'boost::signals::connection'

There is not a great deal you can with this warning other than turn it off.

#pragma warning (disable: 4251)
  ---- ------
#pragma warning (default: 4251)

We do this often. The alternative is to explicitly instantiate your template
code and do the usuall things with __declspec(dllexport) etc.. which turn
into a nightmare to maintain and a serious code bloat as well as exported
dll entries and import libraies.

I try to keep the warning switches as close to the offending code as
possible for documentation reasons, even inside a class declaration:
Here is an example:

class MYPROJECT_EXPORT MyClass
{
 private:
   #pragma warning (disable: 4251)
     std::list<OtherClass*> Talkers;
   #pragma warning (default: 4251)
.....
};

(NB: beware of warnings that make it into precompiled headers)

regards,
Conrad Weyns

> with
> [
> T=boost::signals::detail::basic_connection
> ]
> c:\dev\Libraries\Boost\include\boost-1_32\boost\signals\trackable.hpp(55)
> :
> warning C4251: 'boost::signals::trackable::connected_signals' : class
> 'std::list<_Ty>' needs to have dll-interface to be used by clients of
> class
> 'boost::signals::trackable'
> with
> [
> _Ty=boost::signals::connection
> ]
> c:\dev\Libraries\Boost\include\boost-1_32\boost\signals\slot.hpp(51) :
> warning
> C4251: 'boost::signals::detail::slot_base::data' : class
> 'boost::shared_ptr<T>'
> needs to have dll-interface to be used by clients of class
> 'boost::signals::detail::slot_base'
> with
> [
> T=boost::signals::detail::slot_base::data_t
> ]
> c:\dev\Libraries\Boost\include\boost-1_32\boost\signals\detail\named_slot_map.hpp(100)
> : warning C4251: 'boost::signals::detail::named_slot_map_iterator::impl_'
> :
> class 'boost::scoped_ptr<T>' needs to have dll-interface to be used by
> clients
> of class 'boost::signals::detail::named_slot_map_iterator'
> with
> [
> T=boost::signals::detail::named_slot_map_iterator::impl
> ]
> c:\dev\Libraries\Boost\include\boost-1_32\boost\signals\detail\named_slot_map.hpp(129)
> : warning C4251: 'boost::signals::detail::named_slot_map::impl_' : class
> 'boost::scoped_ptr<T>' needs to have dll-interface to be used by clients
> of
> class 'boost::signals::detail::named_slot_map'
> with
> [
> T=boost::signals::detail::named_slot_map::impl
> ]
> c:\dev\Libraries\Boost\include\boost-1_32\boost\signals\detail\signal_base.hpp(40)
> : warning C4251: 'boost::signals::detail::call_notification::impl' : class
> 'boost::shared_ptr<T>' needs to have dll-interface to be used by clients
> of
> class 'boost::signals::detail::call_notification'
> with
> [
> T=boost::signals::detail::signal_base_impl
> ]
> c:\dev\Libraries\Boost\include\boost-1_32\boost\signals\detail\signal_base.hpp(114)
> : warning C4251: 'boost::signals::detail::signal_base_impl::combiner_' :
> class
> 'boost::any' needs to have dll-interface to be used by clients of class
> 'boost::signals::detail::signal_base_impl'
> c:\dev\Libraries\Boost\include\boost-1_32\boost\any.hpp(22) : see
> declaration of 'boost::any'
> c:\dev\Libraries\Boost\include\boost-1_32\boost\signals\detail\signal_base.hpp(120)
> : warning C4275: non dll-interface class
> 'boost::noncopyable_::noncopyable' used
> as base for dll-interface class 'boost::signals::detail::signal_base'
> c:\dev\Libraries\Boost\include\boost-1_32\boost\noncopyable.hpp(22)
> :
> see declaration of 'boost::noncopyable_::noncopyable'
>
> c:\dev\Libraries\Boost\include\boost-1_32\boost\signals\detail\signal_base.hpp(120)
> : see declaration of 'boost::signals::detail::signal_base'
> c:\dev\Libraries\Boost\include\boost-1_32\boost\signals\detail\signal_base.hpp(150)
> : warning C4251: 'boost::signals::detail::signal_base::impl' : class
> 'boost::shared_ptr<T>' needs to have dll-interface to be used by clients
> of
> class 'boost::signals::detail::signal_base'
> with
> [
> T=boost::signals::detail::signal_base_impl
> ]
>
>
>
> Best,
>
> Klaus
>
> --
> Klaus Nowikow
> DECOMSYS - Dependable Computer Systems
> Development Engineer
> Stumpergasse 48/14, A-1060 Wien, Austria
> Phone: +43 1 59983-31
> Fax: +43 1 59983-731
> http://www.decomsys.com
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
>


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