Object type from a Python extension

Ron Clarke ron_clarke at hp.com
Wed Feb 21 01:04:24 CET 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?

Thanks.





More information about the Python-list mailing list