Boost logo

Boost :

From: MikeEnsor_at_[hidden]
Date: 2001-11-08 14:03:16

I'm looking for a conversion from my own type to Python. I created a
class called "Instance". I need to return that type back to Python.
It is wrapped with boost as a class. The line I use (it isn't
working) is:
PyObject* GetInstance(MyList& l)
   Instance i;
   l.GetInstance(i); // pass by ref, not my code that does this
   return boost::python::to_python(i);

I do have Instance wrapped and included into the module, but I can not
return it back like this. The compiler says that Instance is not one
of the converted types. I can return the "super" type (Instance is
derived from InstBase), and that works, but it does not have the
specific info I need from Instance. Does this clear things up more?
Thank you very much for helping me out.


--- In boost_at_y..., "David Abrahams" <david.abrahams_at_r...> wrote:
> Hi Mike,
> Sorry, I'm a bit lost. There is a to_python(PyObject*) declaration
> boost/python/conversions.hpp. Is that not what you're looking for?
> -Dave
> ----- Original Message -----
> From: <MikeEnsor_at_C...>
> To: <boost_at_y...>
> Sent: Thursday, November 08, 2001 1:41 PM
> Subject: [boost] Boost.Python question
> > I am trying to return an already wrapped c++ object from a
> > The way I have it set is that I return a PyObject* which is
> > depending on the input and various other functions. I have no
> > creating binary, string, double, and int values and returning them
> > a PyObject*. However, I can not figure out how to return a
> > (copied or reference) back to Python via PyObject. When I try to
> > return using boost::python::to_python(obj) the compiler says that
> > there is not a converstion. I have included it in the module, but
> > I have to create a "to_python"? Where do I find details on how to
> > that? Thank you,
> > Mike Ensor
> >
> >
> > Info: Unsubscribe:
> <mailto:boost-unsubscribe_at_y...>
> >
> > Your use of Yahoo! Groups is subject to
> >
> >

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