Py_BuildValue() and C++ arrays
Matthias Stern
mstern at aon.at
Thu Apr 4 03:37:19 EST 2002
I have a C++ function which has to give back to PYTHON an array:
---
static PyObject * ex_readData(PyObject *self, PyObject *args)
{
// define my data array
float data[10000];
:
// call another C++ function which calculates some data
err = TeastAPP::readData(file, elConnName, channel, tmin, tmax, unit,
data, numElem);
return Py_BuildValue( ??? );
}
---
I want to return the values "numElem" (int), "unit" (char[250]) and the
array "data" (float,10000).
What is the correct syntax for "Py_BuildValue( ??? )" ?
The first two parameters work e.g. this way:
---
:
Py_BuildValue("(si)", unit, numElem);
:
---
But how can i send back the data array?!? I cant't write it like this:
---
Py_BuildValue("(iiiiiiiii... (10.000 time)... iiiii)", data);
---
Thx, Mac
More information about the Python-list
mailing list