Object type from a Python extension

Ron Clarke ron_clarke at hp.com
Tue Feb 20 19:04:24 EST 2001

I am creating a shared library (Win32 DLL and Linux '.so') using C++. I have
it all wired up and working from both environments, but I cannot understand
how to get Python scripts to recognize an object created in the C++ code.

For example:

class something( )
    //some variables
    //some public methods

something* ps = new something()
//...do stuff with ps object

//Now when I pass the ps object back to Python using Py_BuildValue(...), the
Python script knows about the object, but does not know it is of type
'something'. I'm obviously missing some connection, but have been through
all the extending and embedding documentation, along with a few Python
books, and don't see it.

Any ideas?


More information about the Python-list mailing list