logo       

Re: FW: Object Lifetime Management with Boost-Python V2: msg#00234

lib.boost.user

Subject: Re: FW: Object Lifetime Management with Boost-Python V2

David Abrahams <dave@xxxxxxxxxxxxxxxxxxxx> writes:

> "Daniel Paull" <dlp@xxxxxxxxxxxxxxxxxxxxxxx> writes:
>
> Please post Boost.Python questions to the C++-sig:
>
> http://www.python.org/sigs/c++-sig/
>
>> Hi all,
>>
>> I'm having trouble with some object lifetime issues using Boost Python
>> V2. Basically, I'm in a situation where both C++ and Python want to
>> delete the same object.
>
>> Below is a simple example of the scenario. Consider the two classes A
>> and B. An instance of A is passed to B via the setA() method. B then
>> assumes ownership of A and deletes it in it's destructor. NOTE: the
>> behaviour of the C++ code can not be changed currently.
>>
>
> There's currently no good way to express what you want in
> Boost.Python.

Daniel,

Since I checked in the changes to support passing auto_ptr<> objects
into and out of wrapped functions, you should be able to do what you
need. You'll need to write a thin wrapper for your function which
takes an auto_ptr<A> argument and calls its release() member function
to get the object which will be adopted by the C++ code.

HTH,
Dave


--
David Abrahams
dave@xxxxxxxxxxxxxxxxxxxx * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Get 128 Bit SSL Encryption!
http://us.click.yahoo.com/JjlUgA/vN2EAA/xGHJAA/EbFolB/TM
---------------------------------------------------------------------~->

Info: <http://www.boost.org>
Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
Unsubscribe: <mailto:boost-users-unsubscribe@xxxxxxxxxxxxxxx>


Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/





<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise