|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r49202 - trunk/boost/asio/detail
From: chris_at_[hidden]
Date: 2008-10-09 02:34:48
Author: chris_kohlhoff
Date: 2008-10-09 02:34:48 EDT (Thu, 09 Oct 2008)
New Revision: 49202
URL: http://svn.boost.org/trac/boost/changeset/49202
Log:
Make the service_registry's usage of typeid work when the default gcc
linker visibility is set to hidden.
Text files modified:
trunk/boost/asio/detail/service_registry.hpp | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
Modified: trunk/boost/asio/detail/service_registry.hpp
==============================================================================
--- trunk/boost/asio/detail/service_registry.hpp (original)
+++ trunk/boost/asio/detail/service_registry.hpp 2008-10-09 02:34:48 EDT (Thu, 09 Oct 2008)
@@ -37,6 +37,21 @@
namespace asio {
namespace detail {
+#if defined(__GNUC__)
+# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
+# pragma GCC visibility push (default)
+# endif // (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
+#endif // defined(__GNUC__)
+
+template <typename T>
+class typeid_wrapper {};
+
+#if defined(__GNUC__)
+# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
+# pragma GCC visibility pop
+# endif // (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
+#endif // defined(__GNUC__)
+
class service_registry
: private noncopyable
{
@@ -169,7 +184,7 @@
void init_service_id(boost::asio::io_service::service& service,
const boost::asio::detail::service_id<Service>& /*id*/)
{
- service.type_info_ = &typeid(Service);
+ service.type_info_ = &typeid(typeid_wrapper<Service>);
service.id_ = 0;
}
#endif // !defined(BOOST_ASIO_NO_TYPEID)
@@ -189,7 +204,8 @@
const boost::asio::io_service::service& service,
const boost::asio::detail::service_id<Service>& /*id*/)
{
- return service.type_info_ != 0 && *service.type_info_ == typeid(Service);
+ return service.type_info_ != 0
+ && *service.type_info_ == typeid(typeid_wrapper<Service>);
}
#endif // !defined(BOOST_ASIO_NO_TYPEID)
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk