On Aug 5, 11:19 pm, "Gabriel Genellina" <gagsl-...@yahoo.com.ar> wrote: > En Wed, 05 Aug 2009 20:12:09 -0300, Sparky <samnspa...@gmail.com> escribió: > > > > > > > Hello! I am trying to call this method: > > > long _stdcall AIBurst(long *idnum, [...] > > long timeout, > > float (*voltages)[4], > > long *stateIOout, > > long *overVoltage, > > long transferMode); > > > I am having some problems with that float (*voltages)[4]. > > pointerArray = (ctypes.c_void_p * 4) > > voltages = pointerArray(ctypes.cast(ctypes.pointer > > ((ctypes.c_long * 4096)()), ctypes.c_void_p), ctypes.cast > > (ctypes.pointer((ctypes.c_long * 4096)()), ctypes.c_void_p), > > ctypes.cast(ctypes.pointer((ctypes.c_long * 4096)()), > > ctypes.c_void_p), ctypes.cast(ctypes.pointer((ctypes.c_long * 4096) > > Why c_long and not c_float? > Anyway, this way looks much more clear to me (and doesn't require a cast): > > arr4096_type = ctypes.c_float * 4096 > voltages_type = arr4096_type * 4 > voltages = voltages_type() > > > The program runs but the values that come back in the array are not > > right. > > Thay might be due to the long/float confusion. > > -- > Gabriel Genellina
Brilliant! Your code is much cleaner and the problem must have been float vs long. Thanks, Sam -- http://mail.python.org/mailman/listinfo/python-list