Associating a C++ class with a Python class

John Dunn jhndnn at yahoo.com
Fri Jun 14 16:12:41 EDT 2002


I would like to add a new class type to my embedded python engine and
I would like this class to wrap an exisiting C++ class instance. All
of the examples I have found are more 'c implementation' than 'c
wrappers', meaning that the python instance is not associated with an
different c++ class. The methods of the python class will just be
straight calls through to the C++ class.

These classes will only be created from C, so I am basically looking
for a way to stuff a pointer to my C++ class into the python object. I
guess I could have a map of PyObject->C++ class, but I was hoping
there was a cleaner way to accompish this task. Is there a standard
way to do this? Am I missing something obvious?

Thanks-

John
--
John Dunn
Peak Audio, a division of Cirrus Logic, Inc.
http://www.peakaudio.com



More information about the Python-list mailing list