Skip to content

Commit 5bab5a2

Browse files
committed
Fix GCC export limiting patch from Niall Douglas s_sourceforge-at-nedprod.com
[SVN r25279]
1 parent 2ca8be0 commit 5bab5a2

File tree

3 files changed

+23
-33
lines changed

3 files changed

+23
-33
lines changed

include/boost/python/detail/config.hpp

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -65,49 +65,44 @@
6565
# define BOOST_PYTHON_DYNAMIC_LIB
6666
#endif
6767

68-
#if defined(__MWERKS__) \
69-
|| (defined(__DECCXX_VER) && __DECCXX_VER <= 60590002) \
70-
|| (defined(__sgi) && defined(_COMPILER_VERSION) && _COMPILER_VERSION <= 730)
71-
# define BOOST_PYTHON_NO_TEMPLATE_EXPORT
72-
#endif
73-
7468
#if defined(BOOST_PYTHON_DYNAMIC_LIB)
75-
# if (defined(_WIN32) || defined(__CYGWIN__))
69+
70+
# if !defined(_WIN32) && !defined(__CYGWIN__) \
71+
&& defined(__GNUC__) && __GNUC__ >= 3 && __GNUC_MINOR__ >=5 \
72+
&& !defined(BOOST_PYTHON_GCC_SYMBOL_VISIBILITY)
73+
# define BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY
74+
# endif
75+
76+
# if defined(BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY)
7677
# if defined(BOOST_PYTHON_SOURCE)
77-
# define BOOST_PYTHON_DECL __declspec(dllexport)
78+
# define BOOST_PYTHON_DECL __attribute__ ((visibility("default")))
7879
# define BOOST_PYTHON_BUILD_DLL
7980
# else
80-
# define BOOST_PYTHON_DECL __declspec(dllimport)
81+
# define BOOST_PYTHON_DECL
8182
# endif
82-
# elif (defined(__GNUC__) && __GNUC__ >= 3 && __GNUC_MINOR__ >=5)
83+
# define BOOST_PYTHON_DECL_FORWARD
84+
# define BOOST_PYTHON_DECL_EXCEPTION __attribute__ ((visibility("default")))
85+
# elif (defined(_WIN32) || defined(__CYGWIN__))
8386
# if defined(BOOST_PYTHON_SOURCE)
84-
# define BOOST_PYTHON_DECL __attribute__ ((visibility("default")))
87+
# define BOOST_PYTHON_DECL __declspec(dllexport)
8588
# define BOOST_PYTHON_BUILD_DLL
86-
# define BOOST_PYTHON_NODECL_DECLARATIONS
8789
# else
88-
# define BOOST_PYTHON_DECL
90+
# define BOOST_PYTHON_DECL __declspec(dllimport)
8991
# endif
9092
# endif
9193

92-
// MinGW, at least, has some problems exporting template instantiations
93-
# if defined(__GNUC__) && __GNUC__ < 3 && !defined(__CYGWIN__)
94-
# define BOOST_PYTHON_NO_TEMPLATE_EXPORT
95-
# endif
96-
9794
#endif
9895

9996
#ifndef BOOST_PYTHON_DECL
10097
# define BOOST_PYTHON_DECL
10198
#endif
10299

103-
#ifndef BOOST_PYTHON_EXPORT
104-
# define BOOST_PYTHON_EXPORT extern
105-
#endif
100+
#ifndef BOOST_PYTHON_DECL_FORWARD
101+
# define BOOST_PYTHON_DECL_FORWARD BOOST_PYTHON_DECL
102+
#endif
106103

107-
#if !defined(BOOST_PYTHON_NO_TEMPLATE_EXPORT)
108-
# define BOOST_PYTHON_EXPORT_CLASS_TEMPLATE(instantiation) BOOST_PYTHON_EXPORT template class BOOST_PYTHON_DECL instantiation
109-
#else
110-
# define BOOST_PYTHON_EXPORT_CLASS_TEMPLATE(instantiation) struct ThIsTyPeNeVeRuSeD
104+
#ifndef BOOST_PYTHON_DECL_EXCEPTION
105+
# define BOOST_PYTHON_DECL_EXCEPTION BOOST_PYTHON_DECL
111106
#endif
112107

113108
#if (defined(__DECCXX_VER) && __DECCXX_VER <= 60590041)

include/boost/python/errors.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

1515
namespace boost { namespace python {
1616

17-
struct BOOST_PYTHON_DECL error_already_set
17+
struct BOOST_PYTHON_DECL_EXCEPTION error_already_set
1818
{
19-
virtual ~error_already_set();
19+
virtual ~error_already_set();
2020
};
2121

2222
// Handles exceptions caught just before returning to Python code.

include/boost/python/object/instance.hpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,7 @@
1111

1212
namespace boost { namespace python
1313
{
14-
#ifdef BOOST_PYTHON_NODECL_DECLARATIONS
15-
// Only declaring with BOOST_PYTHON_DECL makes no sense on GCC
16-
struct instance_holder;
17-
#else
18-
struct BOOST_PYTHON_DECL instance_holder;
19-
#endif
14+
struct BOOST_PYTHON_DECL_FORWARD instance_holder;
2015
}} // namespace boost::python
2116

2217
namespace boost { namespace python { namespace objects {

0 commit comments

Comments
 (0)