Say I have the following C
function:
void getArrOfStructs(SomeStruct** ptr, int* numElements)
And the following C
struct:
typedef struct SomeStruct
{
int x;
int y;
};
I am able to successfully get a Python list:
class SomeStruct(Structure):
_fields_ = [('x', c_int),
('y', c_int)]
ptr, numElements = pointer(SomeStruct()), c_int()
myDLL.getArrOfStructs(byref(ptr), byref(numElements)))
I want to get a NumPy structured / regular array.
- Structured vs Regular array: which one is preferable (in terms of terminology)?
- How can I do it? I'm looking for an efficient way (without copy each cell). I tried NumPy's
frombuffer()
functions, but was only able to use it with regularC
arrays.