[C++-sig] pyste and functions returning opaque pointers
Gottfried Ganßauge
ganssauge at gmx.de
Sat Jul 5 18:20:41 CEST 2003
Hi,
i am wrapping a C library containing several functions returning opaque
pointers.
When i wrap several functions returning the same opaque pointer, the
BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID-Makro for the pointer type is issued
as many times as I'm having functions returning the same pointer type.
Consider the following source:
ggbug.h
=====
typedef struct anonymous *type1;
type1 f1();
type1 f2()
ggbug.pyste
========
h = AllFromHeader("ggbug.h")
set_policy (
h.f1,
return_value_policy(return_opaque_pointer))
set_policy (
h.f2,
return_value_policy(return_opaque_pointer))
"pyste ggbug.pyste" produces the following
ggbug.cpp
=======
// Includes
====================================================================
#include <boost/python.hpp>
#include <ggbug.h>
// Using
=======================================================================
using namespace boost::python;
// Declarations
================================================================
BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID(anonymous)BOOST_PYTHON_OPAQUE_SPECIA
LIZE
D_TYPE_ID(anonymous)
// Module
======================================================================
BOOST_PYTHON_MODULE(ggbug)
{
def("f1", &f1, return_value_policy< return_opaque_pointer >());
def("f2", &f2, return_value_policy< return_opaque_pointer >());
}
I think that one of the BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID(anonymous)'s
shouldn't be there
Cheers,
Gottfried Ganßauge
More information about the Cplusplus-sig
mailing list