[C++-sig] wrapping a function that takes a void*

Matthew Scouten matthew.scouten at gmail.com
Fri Oct 12 18:44:59 CEST 2007

On 10/12/07, English, Mark <Mark.English at rbccm.com> wrote:
> X-Replace-Address: mark.ignorethisbit.english at xxxrbccmxxx.ignorethisbittoo_and_removethosepreceding_xxxs_.com
> > -----Original Message-----
> > From: c++-sig-bounces at python.org [mailto:c++-sig-bounces at python.org]On
> > Behalf Of Matthew Scouten
> > Sent: 12 October 2007 17:19
> > To: Development of Python/C++ integration
> > Subject: [C++-sig] wrapping a function that takes a void*
> >
> >
> > I am wraping a function that takes a void* as an argument.
> Is an opaque pointer what you're looking for ?
> http://www.boost.org/libs/python/doc/v2/return_opaque_pointer.html
> Note there are some potential bugs in this. The PyTypeObject's name causes a crash I believe but I'm using boost 1.32, Python 2.3.6 so it may have been fixed by now in either of those.
> For example using the example code:
> >>> import opaque_ext
> >>> p = opaque_ext.get()
> >>> type(p) #Causes an access violation
> Cheers,
> mE

No, I need the opposite of that. I have a reference to some python
object (any python object) that needs to be passed to a c++ function
expecting a (void *). Later, that object will be handed back to python
as a reference again.

It is fine to tell the python programmer that it is his problem to
prevent the object from being GCed in the meantime.

More information about the Cplusplus-sig mailing list