[C++-sig] [boost.python] void ptr problem

michael_gruner at arcor.de michael_gruner at arcor.de
Mon Aug 7 13:58:55 CEST 2006


Hello, 


I'm trying to use boost.python to wrap a C function that takes a pointer on a void pointer as an argument. But I'm going wrong to use the example from the FAQ. Could anyone help me on this? 


my code looks like this: 


struct void_; 
BOOST_PYTHON_OPAQUE_SPECIALIZED_TYPE_ID(void_); 


int myfunc(char * mychar, void ** mypointer); 


int myfunc_wrp(char * mychar, void_ ** mypointer){ 
        return myfunc(mychar,(void ** ) mypointer); 
} 


... 


BOOST_PYTHON_MODULE(mymodule){ 


        def("myfunc", &myfunc_wrp); 
} 


later in python I do: 


import mymodule 


mystring = " " 
mypointerobject = 0 


mymodule.myfunc(mystring,mypointerobject) 


and get: 
Boost.Python.ArgumentError: Python argument types in mymodule.myfunc(str, int) 
did not match C++ signature: 
        myfunc(char *, struct void_ * *) 



Are there any advices to solve this problem? 


thank you for your answers. 


Kind regards, 


Michael 






More information about the Cplusplus-sig mailing list