[C++-sig] Convert C++ Class to exposed class and back

Marcus Jannes jannes80 at hotmail.de
Tue Feb 12 14:09:47 CET 2008



> What are you trying to do here ? What is 'c' ? There shouldn't be any 
> need to use PyObject raw pointers at all. Assuming 'ExpClass' has 
> already been exported, the following should Just Work:
> 
> ExpClass a = ...;
> bp::object o(a); //<--- now holds a copy of 'a'
> ...
> ExpClass b = bp::extract(o); //<--- attempts to extract an
>                                         //     ExpClass from 'o'
> 
>> };

Thank you, this seems to go into the right direction, but i need the PyObject pointer for a function like:
PyEval_CallObject();

if i use it with the code above: PyEval_CallObject(_pyfunc_ptr, &o);
i get this error: cannot convert ‘boost::python::api::object*’ to ‘PyObject*’ for argument ‘2’
_________________________________________________________________
Kostenlose Messenger Emoticons! Hier downloaden!
http://messenger.live.de/mein/


More information about the Cplusplus-sig mailing list