Two way communication between a python class and a C++ class

Donn Cave donn at u.washington.edu
Fri Nov 9 00:10:05 CET 2001


Quoth Firestar <dwjoker at thenorth.org>:

| I am having a problem obtaining two way communication between a python
| class and a c++ class. I can get a python class to communcate with a
| c++ class and a c++ class to communicate with a python class, but i
| cannot seem to get the communication to go both ways.
|
| i.e I have a class CTest in c++ and a class PTest in python and when i
| create an instance of CTest in c++ it creates an instance of PTest in
| python, i then want PTest to be able to call methods in the instance
| of CTest that created the instance of PTest. How can i do this? there
| seems to be no way to pass the c++ pointer into the python class in
| the constructor...

The closest I have come to this is an approach like the one described
here: http://www.python.org/workshops/1995-12/papers/ahlstrom1.html

It doesn't work exactly like you describe - at least in mine, neither
class is created by other, nor would that be useful.

You may also find something interesting at http://www.boost.org/.

	Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list