[C++-sig] Problem using the ptr() function

Emmanuel Taurel etaurel at cells.es
Wed Oct 26 15:10:12 CEST 2005


Hello everybody,

 

I am using Boost.python to interface a C++ set of classes. In one of my C+++
class, I am calling a method implemented in Python with the 
boost "call_method" call. This method has one parameter of our own data type
and return a pointer to this type. I have installed converters for this type
as it is adviced in the FAQ "How can I automatically convert my custom
string type..." If I call my method like this

 

MyType *ret = call_method<MyType *>(my_py_obj,"My_method", my_ptr)

 

With my_ptr being a MyType *, it works. But if I call it like this

 

MyType *ret = call_method<MyType *>(my_py_obj,"My_method", ptr(my_ptr)) to
avoid a copy, I received a run time error complaining that 

 

"No Python class registered for C++..."

 

Could someone explain me why it works in the first case and not in the
second one.

 

Many thanks in advance

 

Emmanuel Taurel (etaurel at cells.es)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20051026/cdd4b0d0/attachment.htm>


More information about the Cplusplus-sig mailing list