Re: [C++-sig] Boost.Python visibility fix for GCC 4.0

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [C++-sig] Boost.Python visibility fix for GCC 4.0

Allen Bierbaum
Hello all:

I haven't heard anything back about this patch.  As far as I know, boost
python will not work with gcc 4.x and the visibility flags without
changes similar to this.  Is this the correct place to post such a
patch?  Is there some other known workaround that I am not aware of?

Thanks,
Allen

Allen Bierbaum wrote:

> It looks like the current version of Boost.Python has a small bug when
> using the visibility options of gcc 4.0 (i.e. -fvisibility=hidden).  I
> have attached a patch that will fix the problem.  It looks like when
> the code was originally added to test for the GCC version it didn't
> take into account non 3.x version numbers.  This patch should take
> care of that.
>
> Note: This bug rears its head by hiding the extern C initmodule() when
> you compile a Boost.Python module with "-fvisibility=hidden".  Thus
> the module fails to import into python because the symbol is not found.
>
> Hopefully this should fix things up for everyone.
>
> -Allen
>
>------------------------------------------------------------------------
>
>Index: boost/python/module_init.hpp
>===================================================================
>RCS file: /cvsroot/boost/boost/boost/python/module_init.hpp,v
>retrieving revision 1.6
>diff -u -r1.6 module_init.hpp
>--- boost/python/module_init.hpp 20 Sep 2004 12:47:31 -0000 1.6
>+++ boost/python/module_init.hpp 23 Aug 2005 21:27:15 -0000
>@@ -42,7 +42,7 @@
> }                                                                       \
> void init_module_##name()
>
>-# elif (defined(__GNUC__) && __GNUC__ >= 3 && __GNUC_MINOR__ >=5)
>+# elif (defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >=5)))
>
> #   define BOOST_PYTHON_MODULE_INIT(name)                               \
> void init_module_##name();                                              \
>@@ -64,6 +64,6 @@
>
> #  endif
>
>-# endif
>+# endif
>
> #endif // MODULE_INIT_DWA20020722_HPP
>Index: boost/python/detail/config.hpp
>===================================================================
>RCS file: /cvsroot/boost/boost/boost/python/detail/config.hpp,v
>retrieving revision 1.37
>diff -u -r1.37 config.hpp
>--- boost/python/detail/config.hpp 29 Nov 2004 21:32:14 -0000 1.37
>+++ boost/python/detail/config.hpp 23 Aug 2005 21:27:15 -0000
>@@ -69,10 +69,10 @@
> #if defined(BOOST_PYTHON_DYNAMIC_LIB)
>
> #  if !defined(_WIN32) && !defined(__CYGWIN__)                  \
>-    && defined(__GNUC__) && __GNUC__ >= 3 && __GNUC_MINOR__ >=5 \
>+    && defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >=5)) \
>     && !defined(BOOST_PYTHON_GCC_SYMBOL_VISIBILITY)
> #    define BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY
>-#  endif
>+#  endif
>
> #  if defined(BOOST_PYTHON_USE_GCC_SYMBOL_VISIBILITY)
> #     if defined(BOOST_PYTHON_SOURCE)
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>C++-sig mailing list
>[hidden email]
>http://mail.python.org/mailman/listinfo/c++-sig
>  
>

_______________________________________________
C++-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/c++-sig
Reply | Threaded
Open this post in threaded view
|

Re: [C++-sig] Boost.Python visibility fix for GCC 4.0

Niall Douglas
On 5 Sep 2005 at 13:16, Allen Bierbaum wrote:

> Hello all:
>
> I haven't heard anything back about this patch.  As far as I know,
> boost python will not work with gcc 4.x and the visibility flags
> without changes similar to this.  Is this the correct place to post
> such a patch?  Is there some other known workaround that I am not
> aware of?

Yeah it was a typo by me:

&& defined(__GNUC__) && __GNUC__ >= 3 && __GNUC_MINOR__ >=5 \

should be:

&& defined(__GNUC__) && __GNUC__ >= 4 \

Cheers,
Niall



_______________________________________________
C++-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/c++-sig