Passing a Null pointer after ndarray prototype definition
Dec. 30, 2007
3:42 p.m.
I have a problem in that I have a DLL function which accepts several numpy double arrays, but you need to pass a NULL pointer for the ones from which you do not require results. The prototype is as follows: T_ndDp = numpy.ctypeslib.ndpointer(dtype=float, ndim=1, flags='C_CONTIGUOUS') Prototype_example = CFUNCTYPE(None, c_long, T_ndDp, T_ndDp, T_ndDp) In ctypes None is equivelent to NULL, though in order to get past the prototype argchecks you need to cast the object to None. If for example the pointer was to a simple double one could write something like: cast(None, POINTER(c_double)) the problem is in casting to None for the above (T_ndDp) type Any help would be greatly appreciated Nicholas
6236
Age (days ago)
6236
Last active (days ago)
0 comments
1 participants
participants (1)
-
Nicholas