Need Help locating information about C++ classes & Python

Gary McNickle gary at
Tue Oct 15 17:21:59 CEST 2002

I'm attempting to embed python into my c++ application.   All has gone well
so far, I can successfully call python functions, and have python call my c
functions. However, I'm having problems finding documentation on how to deal
with c++ classes.  In my case...

I have a parent class (A property manager)

class CPropertyMgr
    // if szName property is found and is of type int, return it's value.
else return -1
    int    GetInt(char* szName);

Classes that inherit from CPropertyMgr "Register" properties that they want
the end user to have access to via python, for example;

Register("Value", &m_nValue);

So that ideally, a python object would say;

pyObject = my_app.GetActor("SomeActor")
nValue = pyObject.GetInt("Value")

So far, I can locate the class and return it to Python (cast as a
pyObject*), but I cant access any functions or members of the class. (I get
an exception fault if I try).

I dont reallly want to use something like boost.Python because it has so
much more than what I need. Really, all I need to be able to do is call
these "GetTYPE" and "SetTYPE" functions from within the python script.  They
all return standard types (int, char*, float, double, etc).

If someone can point me to some documentation on accomplishing this, I would
greatly appreciate it.


More information about the Python-list mailing list