I am working on creating a python c extension, but it's hard for me to find documentation on what I want to do. I basically want to create a pointer to cstruct and have access to that pointer. The following is sample code. Any help would be appreciated.
typedef struct{ int x; int y; } Point; typedef struct { PyObject_HEAD Point* my_point; } PointObject; static PyTypeObject PointType = { PyObject_HEAD_INIT(NULL) 0, "point", sizeof(PointObject), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Py_TPFLAGS_DEFAULT, "point objects", }; static PyObject* set_point(PyObject* self, PyObject* args) { PyObject* point; if (!PyArg_ParseTuple(args, "O", &point)) { return NULL; }
source share