Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-03-10 09:26:42


Marco Borm <mb.ml.boost_at_[hidden]> writes:

> David Abrahams wrote:
>> Marco Borm <mb.ml.boost_at_[hidden]> writes:
>>
>>> It is also possible to do the following in my c++ object-code: "ret
>>> = boost::python::call<int>(PyFunction.ptr(), this );"
>> But not so elegant or safe as:
>> ret = boost::python::extract<int>( PyFunction( *this ) );
> thats true :-)
>
>>>But now my problem: boost copies the object and passes only that
>>>copy to the function. Is it and how is it possible to make the
>>>object accessible to the function within the python-script?
>> ret = boost::python::extract<int>( PyFunction( boost::ref(*this)
>> ) );
> To clarify: "this" isn't an instance of an boost/python object.
> The Instance is created somewhere else without boost/python.

Right, I expected that. The code I gave you is designed to account
for that.

> Because this, the code you gave me crashs in wrapper_base.hpp on an
> "dynamic_cast<wrapper_base const volatile*>(x)"

I'm pretty sure that is not why your code is crashing.

> An example for what I want:

If you post an actual compilable example that reproduces the problem
to the C++-sig (http://www.boost.org/more/mailing_lists.htm#cplussig)
I might find time to debug it.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk