Boost logo

Boost Users :

From: David Abrahams (dave_at_[hidden])
Date: 2003-02-24 17:03:23


"mghiggins <mghiggins_at_[hidden]>" <mghiggins_at_[hidden]> writes:

> Excuse my newbiness if this question is too dumb... :)
>
> I've built a python extension from a C++ class using boost - it all
> seems to work fine.
>
> However, now another C++ function is receiving a pointer to a PyObject
> that represents an instance of this "boosted" python class. How do I
> pick off a pointer to the underlying C++ object from the PyObject
> pointer?

Boost.Python questions to the c++-sig, please!

  http://www.python.org/sigs/c++-sig/

Your answer:

  void f(PyObject* p)
  {
     handle<> ph(borrowed(p));
     MyObj* op = extract<MyObj*>(object(ph));
  }

HTH,
Dave

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

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net