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

Matthew Scouten matthew.scouten at gmail.com
Fri Oct 12 21:02: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
> > 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.
> Ok. How about:
> int Special_wrapper::fooRequest(boost::python::object objUserData)
> {
>         return  fooRequest((void*) objUserData.ptr());
> }

Ok, that looks sane.
two questions though:
1) I assume I get the 'object' back with ' object o(p) ' where is a
void pointer?

2) how do I handle the default argument?  the export used to be
.def("fooRequest" ,&Special_wrapper::fooRequest ,(arg("userData") =
Can I get a None to use in place of that NULL?

More information about the Cplusplus-sig mailing list