ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> cpp-sig
cpp-sig
[C++-sig] Re: C++ object from PyObject pointer
by David Abrahams other posts by this author
Feb 24 2003 10:03PM messages near this date
[C++-sig] Re: boost.python answer - thanks! | [C++-sig] Re : How to wrap this overloaded member function whose return type is reference ?
The following message is a courtesy copy of an article
that has been posted to gmane.comp.lib.boost.user as well.

"mghiggins <mghiggins@[...].com> " <mghiggins@[...].com> 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


_______________________________________________
C++-sig mailing list
C++-sig@[...].org
http://mail.python.org/mailman/listinfo/c++-sig

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved