AW: [C++-sig] Re: Defining Policies for unknown data handles

Nicodemus nicodemus at globalite.com.br
Tue Apr 8 00:10:46 CEST 2003


Gottfried.Ganssauge at HAUFE.DE wrote:

>...
>  
>
>>Yes, I forgot about the specialization, sorry 8/. Thanks Gottfried!
>>
>>
>>Here's the generated file:
>>
>>    // Includes
>>    
>>====================================================================
>>    #include <boost/python.hpp>
>>    #include <test.h>
>>
>>    // Using
>>    
>>==============================================================
>>=========
>>    using namespace boost::python;
>>
>>    // Declarations
>>    ================================================================
>>    namespace  {
>>    
>>
>What's that namespace good for?
>Presumably BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID defines a specialization
>in namespace boost::python. With the above namespace in place that
>specialization is defined within an anonymous namespace.
>  
>

In this namespace goes all the other declarations, like virtual wrappers 
and overloads.

>>    BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID(opaque_)
>>
>>    }// namespace
>>
>>
>>    // Module
>>    
>>======================================================================
>>    BOOST_PYTHON_MODULE(test)
>>    {
>>        def("open_opaque", &open_opaque, return_value_policy<
>>    return_opaque_pointer >());
>>    } 
>>
>>
>>But this is producing compiler errors in my machine (Windows 
>>XP, Intel 
>>6.0, STLport-4.5.3):
>>
>>
>>    test.cpp
>>    test.cpp(13): error: "type_info" is ambiguous
>>      BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID(opaque_)
>>      ^
>>
>>    test.cpp(13): error: "type_id" is not a class or function template
>>    name in the current scope
>>      BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID(opaque_)
>>      ^
>>
>>    test.cpp(13): error: expected a ";"
>>      BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID(opaque_)
>>
>>    ... snip more 1452 lines of errors. 8P
>>
>>
>>
>>I believe the code is correct, seems more like a problem with 
>>my setup. 
>>Any ideas?
>>    
>>
>Sorry, I don't have that compiler available, only could check the code with
>gcc-3.2
>I would try without that namespace.
>
That was the problem. 8)

Thanks Gottfried!
Nicodemus.







More information about the Cplusplus-sig mailing list