T
tkirke
How does one transfer a buffer object from python -> c and back again
(assuming the data gets modified)?
I can't seem to get this or anything else to work, but am clueless as
to what I'm doing wrong
using namespace boost:ython;
static PyObject * proc_buf(PyObject *self, PyObject *args) {
PyObject *resultobj;
char* output_samples;
int len;
if (!PyArg_ParseTuple(args,"s#|l",&output_samples, &len)) {
return NULL; /* wrong arguments provided */
}
for (int i=0;i<len;i++) {
output_samples *= 2; // for example
}
resultobj = PyString_FromStringAndSize(output_samples, len);
return resultobj;
}
This compiles ok, but when in python I do
buf = proc_buf( bufx, len(bufx)
len(buf)
I get
len() of unsized object
Thanks
(assuming the data gets modified)?
I can't seem to get this or anything else to work, but am clueless as
to what I'm doing wrong
using namespace boost:ython;
static PyObject * proc_buf(PyObject *self, PyObject *args) {
PyObject *resultobj;
char* output_samples;
int len;
if (!PyArg_ParseTuple(args,"s#|l",&output_samples, &len)) {
return NULL; /* wrong arguments provided */
}
for (int i=0;i<len;i++) {
output_samples *= 2; // for example
}
resultobj = PyString_FromStringAndSize(output_samples, len);
return resultobj;
}
This compiles ok, but when in python I do
buf = proc_buf( bufx, len(bufx)
len(buf)
I get
len() of unsized object
Thanks