[C++-sig] Passing objects between python / c++

Roman Yakovenko roman.yakovenko at gmail.com
Fri Oct 27 21:42:53 CEST 2006


On 10/27/06, Mark Williams <mark at image-engine.com> wrote:
>
>
> >> You are right - it is an identity problem. However, before posting my original question I had  already been through the lists to see if there was an existing solution. The threads I've found on the subject - the most notable of which appears to be http://mail.python.org/pipermail/c++-sig/2006-March/010458.html - seem
> >> to tail off without a conclusion being made. I see that internally boost.python contains many references to shared_ptr, and I have confirmed through a number of tests that the identity problem appears to be solved if shared_ptrs are employed, unfortunately I'm in a position where I cannot change the C++ I'm
> >> binding to use a different smart pointer type.
> >>
> >> Is there anything else I might try, or is this unfixable?
> >
> >I don't have enough knowledge to answer the question.
> >It seems to me that you can create small work around:
> >redefine store and retrieve function in Python, save the reference to the python
> >object somewhere, next time user will ask to retrieve the object, you can return
> >the object you stored earlier in Python.
> >
>
> Thanks for your help.

My pleasure.
Do you mind if I will add the code you have posted in this thread to the web
pages:
http://language-binding.net/pyplusplus/bpl_lessons_learned/smart_ptrs/smart_ptrs.html

-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/



More information about the Cplusplus-sig mailing list