I am trying to write a python C shell for a function (libFunc), the prototype of which is
libFunc(char**, int*, char*, int)
How to use PyArg_ParseTuple to configure arguments for calling a function. That's what i currently
#include <Python.h> PyObject* libFunc_py(PyObject* self, PyObject* args) { char* input; char** output; int inputlen; int* outputlen; PyArg_ParseTuple(args, "sisi" , output, outputlen, &input, &inputlen); int ret = libFunc(output, outlen, input, inputlen); return Py_BuildValue("i", ret); }
I can do the same with ctypes using byref.
source share