Convert a ctypes int pointer array to a numpy array.
(cptr, length)
| 114 | |
| 115 | |
| 116 | def cint8_array_to_numpy(cptr, length): |
| 117 | """Convert a ctypes int pointer array to a numpy array.""" |
| 118 | if isinstance(cptr, ctypes.POINTER(ctypes.c_int8)): |
| 119 | return np.fromiter(cptr, dtype=np.int8, count=length) |
| 120 | else: |
| 121 | raise RuntimeError('Expected int pointer') |
| 122 | |
| 123 | |
| 124 | def c_str(string): |