[C++-sig] gcc flag -fvisibility=hidden not working with boost::python

Renato Araujo renatox at gmail.com
Mon Mar 23 15:42:20 CET 2009


For more details about the problem, I found the correct header witch
give me this problem, and isolate that with this:

#include <boost/python/detail/prefix.hpp>
# include <boost/type_traits/is_polymorphic.hpp>
# include <boost/mpl/bool.hpp>

#pragma GCC visibility push(default)
#include <boost/python/detail/wrapper_base.hpp>
#pragma GCC visibility pop

#include <boost/python.hpp>

BR
Renato


On Sun, Mar 22, 2009 at 12:36 PM, Renato Araujo <renatox at gmail.com> wrote:
> Thanks for the link, I tried a lot of combinations but nothing works
> Then I started looking in boost for the header where I got the error,
> then I found the header but I don't know why this happen. I fix the
> problem with:
>
> #pragma GCC visibility push(default)
> #include <boost/python/call.hpp>
> #pragma GCC visibility pop
> #include <boost/python.hpp>
>
>
> You can try this only changing the "foo/python_headers.h" file in my
> previous example.
>
> I don't know if this is the correct way to fix this. Someone can talk about?
>
>
> BR
>
>
> On Sat, Mar 21, 2009 at 5:38 PM, Niall Douglas
> <s_sourceforge at nedprod.com> wrote:
>> On 20 Mar 2009 at 13:46, Renato Araujo wrote:
>>
>>> I have worked with some gcc flags to reduce my binding size. After
>>> some time using this -fvisibility=hidden with my library, I discovered
>>> a strange behavior on boost::python more specific in object call
>>> function like this:
>>>
>>> python::call_method<void>(py_obj.ptr(), "myVirtualFunction");
>>>
>>> The problem is: When I use this flag boost always call my "virtual
>>> default" implementation and without this flag boost always call the
>>> correct virtual method, I don't know what this is happening. I would
>>> like to know if someone has any idea why this is happening?
>>>
>>> I create this small test to show the problem. This flags is very
>>> important for me because I got size reduction about 50% with this.
>>
>> You're not annotating your wrapper class correctly.
>>
>> See http://www.nedprod.com/programs/gccvisibility.html.
>>
>> Cheers,
>> Niall
>>
>>
>>
>> _______________________________________________
>> Cplusplus-sig mailing list
>> Cplusplus-sig at python.org
>> http://mail.python.org/mailman/listinfo/cplusplus-sig
>>
>
>
>
> --
> Renato Araujo Oliveira Filho
>



-- 
Renato Araujo Oliveira Filho


More information about the Cplusplus-sig mailing list