From 3879045fb7961c927a8de2e3c55b0c3fe9a3a16a Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Thu, 10 Aug 2017 12:03:29 -0400 Subject: [PATCH 1/6] Force hidden visibility on pybind code This adds a PYBIND11_NAMESPACE macro that expands to the `pybind11` namespace with hidden visibility under gcc-type compilers, and otherwise to the plain `pybind11`. This then forces hidden visibility on everything in pybind, solving the visibility issues discussed at end end of #949. --- include/pybind11/attr.h | 4 ++-- include/pybind11/buffer_info.h | 4 ++-- include/pybind11/cast.h | 4 ++-- include/pybind11/chrono.h | 4 ++-- include/pybind11/class_support.h | 4 ++-- include/pybind11/common.h | 15 +++++++++++++-- include/pybind11/complex.h | 4 ++-- include/pybind11/descr.h | 4 ++-- include/pybind11/eigen.h | 4 ++-- include/pybind11/embed.h | 4 ++-- include/pybind11/eval.h | 4 ++-- include/pybind11/functional.h | 4 ++-- include/pybind11/numpy.h | 4 ++-- include/pybind11/operators.h | 4 ++-- include/pybind11/options.h | 4 ++-- include/pybind11/pybind11.h | 4 ++-- include/pybind11/pytypes.h | 4 ++-- include/pybind11/stl.h | 4 ++-- include/pybind11/stl_bind.h | 4 ++-- include/pybind11/typeid.h | 4 ++-- 20 files changed, 51 insertions(+), 40 deletions(-) diff --git a/include/pybind11/attr.h b/include/pybind11/attr.h index 44a33458da..54760cdbc9 100644 --- a/include/pybind11/attr.h +++ b/include/pybind11/attr.h @@ -12,7 +12,7 @@ #include "cast.h" -NAMESPACE_BEGIN(pybind11) +NAMESPACE_BEGIN(PYBIND11_NAMESPACE) /// \addtogroup annotations /// @{ @@ -478,4 +478,4 @@ constexpr bool expected_num_args(size_t nargs, bool has_args, bool has_kwargs) { } NAMESPACE_END(detail) -NAMESPACE_END(pybind11) +NAMESPACE_END(PYBIND11_NAMESPACE) diff --git a/include/pybind11/buffer_info.h b/include/pybind11/buffer_info.h index 6d1167d212..1f5e3a9531 100644 --- a/include/pybind11/buffer_info.h +++ b/include/pybind11/buffer_info.h @@ -11,7 +11,7 @@ #include "common.h" -NAMESPACE_BEGIN(pybind11) +NAMESPACE_BEGIN(PYBIND11_NAMESPACE) /// Information record describing a Python buffer object struct buffer_info { @@ -105,4 +105,4 @@ template struct compare_buffer_info #endif -NAMESPACE_BEGIN(pybind11) +NAMESPACE_BEGIN(PYBIND11_NAMESPACE) NAMESPACE_BEGIN(detail) // Forward declarations: inline PyTypeObject *make_static_property_type(); @@ -2084,4 +2084,4 @@ NAMESPACE_END(detail) template<> class type_caster : public type_caster_base { }; \ }} -NAMESPACE_END(pybind11) +NAMESPACE_END(PYBIND11_NAMESPACE) diff --git a/include/pybind11/chrono.h b/include/pybind11/chrono.h index 8a41d08b0c..95ada76e0f 100644 --- a/include/pybind11/chrono.h +++ b/include/pybind11/chrono.h @@ -27,7 +27,7 @@ #define PyDateTime_DELTA_GET_MICROSECONDS(o) (((PyDateTime_Delta*)o)->microseconds) #endif -NAMESPACE_BEGIN(pybind11) +NAMESPACE_BEGIN(PYBIND11_NAMESPACE) NAMESPACE_BEGIN(detail) template class duration_caster { @@ -159,4 +159,4 @@ template class type_caster