[C++-sig] Extracting a byte array from C++ to Python array object instance
Kirsebom Nikolai
nikolai.kirsebom at siemens.no
Fri Dec 19 15:21:53 CET 2003
I'm trying to define the interface/code for extracting (and setting) the
byte array of an C++ object into (from) a Python array object (type code
'B').
C++ OBJECT (fragments)
class TheBlob {
unsigned char *GetBufferRef();
int Length();
PyObject *GetBlobIntoPyArray();
int SetBlobFromPyArray(PyObject *pyArray);
};
Python code:
a = TheBlob.GetBlobIntoPyArray()
# a is object of type array (python built-in)
....
TheBlob.SetBlobFromPyArray(a)
Does anyone have hints/links to where I can find info on how to define the
two methods GetBlobIntoPyArray and SetBlobFromPyArray ?
Nikolai
More information about the Cplusplus-sig
mailing list