[C++-sig] In a C++ extension, how to use a C++ class exported in another extension

Clark foo.Clark at gmail.com
Mon Jul 4 20:59:30 CEST 2005


On Mon, Jul 04, 2005 at 08:22:12AM -0400, David Abrahams wrote:
> Clark <foo.Clark at gmail.com> writes:
> 
> >> 
> >> Oh, I see; all Swig objects have the same type?
> > Yes, they are all PySwigObject.
> 
> Please try to leave a blank line above and below quoted material;
> otherwise it's hard to pick out what you're saying.

Thanks for your advice. Actually, I'm a mail list newbie at present. 
I think most of the people here are very kindly. They would like to
help others for nothing.

> 
> >> Well you need some way to identify the Python objects for which the
> >> above statement is true, unless you want to forego all error checking
> >> and just allow a crash if a Swig-wrapped Foo is passed where a
> >> Swig-wrapped Bar is expected.
> > Sometimes it's critical. 
> 
> Sometimes it's critical to... identify the Python objects for which
> the above statement is true?  Forego all error checking and allow a
> crash?  Something else?

to extract a C++ "this" pointer from a SWIG-wrapped object. 

> 
> > For example, to paint on screen efficiently, we must use the DC's
> > methods in C++ directly. But because usually the GUI or framework is
> > written in Python, we can only get the DC as a Python Object.
> 
> I don't see the connection between that scenario and anything we're
> discussing.

en... The GUI library I used is wxPython, which is wrapped by SWIG. And
other parts of my program is wrapped by Boost.Python. I need extract a
C++ pointer wxDC * from a wxPython's DC. 

> 
> -- 
> Dave Abrahams
> Boost Consulting
> www.boost-consulting.com
> 
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig



More information about the Cplusplus-sig mailing list