[C++-sig] In a C++ extension, how to use a C++ class exported in another extension
foo.Clark at gmail.com
Mon Jul 4 05:46:11 CEST 2005
On Thu, Jun 30, 2005 at 02:17:02PM -0700, Ralf W. Grosse-Kunstleve wrote:
> Thanks for posting this. It is very interesting!
> David, how difficult would it be to provide something like
> so that we could wrap functions taking SWIG-wrapped arguments directly?
> I guess there is no easy way to construct SWIG-wrapped return values without a
> lot of support from SWIG, but automatically extracting the pointer to turn it
Yes. But we can still emulate what SWIG does to make a C++ Object be a
Python Object, and then return it.
> into a T*, T&, const T*, const T& argument seems like something that may not be
> too hard... true?
> Looking some more, isn't this almost it?
> But we want to do it without having the equivalent of noddy_NoddyType, just
> knowing that ((PySwigObject*)obj.ptr())->ptr gives us the T*.
> --- Clark <foo.Clark at gmail.com> wrote:
> > It takes much time of me to solve this problem.
> > The answer is:
> > A class member named "this" is added to every python class wrapped by
> > SWIG. The "this" is a "PySwigObject", which has a member points to
> > the C++ 'this' pointer.
> Do you Yahoo!?
> Read only the mail you want - Yahoo! Mail SpamGuard.
> C++-sig mailing list
> C++-sig at python.org
More information about the Cplusplus-sig