Boost logo

Boost :

From: rwgk_at_[hidden]
Date: 2001-09-06 12:27:20

--- In boost_at_y..., Thomas Malik <Thomas_Malik%LGBANK_at_l...> wrote:
> Could these be added to boost::python (i am using boost 1.23.0) ?

I will look into adding the converters.

> also, i found it more useful to pass a null pointer to a function
> a const char*, if
> specifying None as an argument (see above):

I will look into adding this, too.

> Also, i don't have much of an idea how to wrap pointers to C++ class
> objects in a way such that
> i don't have to wrap the whole class in boost python. This is
> needed for wrapping pointers
> to opaque structs, like the XWindows Display data type. Currently i
> using this:
> ...
> which doesn't look like an exactly clean solution to me. any ideas ?

Looks exactly like a pragmatic solution to me :-)
I believe that there is no good, "clean" solution for passing
pointers to Python. The problem, as far as I understand, is
that there is no mechanism by which you could specify who
owns the instance that the pointer refers to (Python or C++).
Related reading:
Look for "owned_by_arg". These are just ideas. None of this is

> i didn't see any ptr_to_python method, i assume smart_ptr_to_python
> meant.

This was already corrected a few weeks ago.

> However, i didn't find documentation and didn't understand
everything on
> this.
> Could anyone clarify this to me ?

I am afraid that the source code is the documentation.

> My question is, how is an object created and returned by the C++ API
> wrapped into a python
> object ?

This is related to the "returned reference problem": each
wrapped object is copied.

> And how can i make sure that a particular C++ object returned by
> the API is identified
> by a unique Python object (such that i can compare them by the
python 'is'
> operator) ?

Since you will have two separate copies, this might not be
easy. I do not know the answer.

> Is there an 'object registry' or similar ?

There is a class registry, but to my knowledge there is no
object registry... interesting idea.


Boost list run by bdawes at, gregod at, cpdaniel at, john at