From 0b026dc5a2a838649235e9a03f2733400fc5fb7b Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Mon, 20 Sep 2004 12:47:31 +0000 Subject: [PATCH] Apply GCC export limiting patch from Niall Douglas s_sourceforge-at-nedprod.com [SVN r25271] --- include/boost/python/detail/config.hpp | 22 ++++++++++++++++------ include/boost/python/module_init.hpp | 10 ++++++++++ include/boost/python/object/instance.hpp | 5 +++++ 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/include/boost/python/detail/config.hpp b/include/boost/python/detail/config.hpp index b2d2b15f..575b9a78 100644 --- a/include/boost/python/detail/config.hpp +++ b/include/boost/python/detail/config.hpp @@ -71,12 +71,22 @@ # define BOOST_PYTHON_NO_TEMPLATE_EXPORT #endif -#if defined(BOOST_PYTHON_DYNAMIC_LIB) && (defined(_WIN32) || defined(__CYGWIN__)) -# if defined(BOOST_PYTHON_SOURCE) -# define BOOST_PYTHON_DECL __declspec(dllexport) -# define BOOST_PYTHON_BUILD_DLL -# else -# define BOOST_PYTHON_DECL __declspec(dllimport) +#if defined(BOOST_PYTHON_DYNAMIC_LIB) +# if (defined(_WIN32) || defined(__CYGWIN__)) +# if defined(BOOST_PYTHON_SOURCE) +# define BOOST_PYTHON_DECL __declspec(dllexport) +# define BOOST_PYTHON_BUILD_DLL +# else +# define BOOST_PYTHON_DECL __declspec(dllimport) +# endif +# elif (defined(__GNUC__) && __GNUC__ >= 3 && __GNUC_MINOR__ >=5) +# if defined(BOOST_PYTHON_SOURCE) +# define BOOST_PYTHON_DECL __attribute__ ((visibility("default"))) +# define BOOST_PYTHON_BUILD_DLL +# define BOOST_PYTHON_NODECL_DECLARATIONS +# else +# define BOOST_PYTHON_DECL +# endif # endif // MinGW, at least, has some problems exporting template instantiations diff --git a/include/boost/python/module_init.hpp b/include/boost/python/module_init.hpp index 141c792e..64599a38 100644 --- a/include/boost/python/module_init.hpp +++ b/include/boost/python/module_init.hpp @@ -42,6 +42,16 @@ extern "C" \ } \ void init_module_##name() +# elif (defined(__GNUC__) && __GNUC__ >= 3 && __GNUC_MINOR__ >=5) + +# define BOOST_PYTHON_MODULE_INIT(name) \ +void init_module_##name(); \ +extern "C" __attribute__ ((visibility("default"))) void init##name() \ +{ \ + boost::python::detail::init_module(#name, &init_module_##name); \ +} \ +void init_module_##name() + # else # define BOOST_PYTHON_MODULE_INIT(name) \ diff --git a/include/boost/python/object/instance.hpp b/include/boost/python/object/instance.hpp index 6fcc6d44..02648681 100644 --- a/include/boost/python/object/instance.hpp +++ b/include/boost/python/object/instance.hpp @@ -11,7 +11,12 @@ namespace boost { namespace python { +#ifdef BOOST_PYTHON_NODECL_DECLARATIONS + // Only declaring with BOOST_PYTHON_DECL makes no sense on GCC + struct instance_holder; +#else struct BOOST_PYTHON_DECL instance_holder; +#endif }} // namespace boost::python namespace boost { namespace python { namespace objects {