Pointers and ctypes
Mike C. Fletcher
mcfletch at rogers.com
Mon Aug 29 10:33:17 EDT 2005
F. Petitjean wrote:
>Le 29 Aug 2005 06:19:17 -0700, rubbishemail at web.de a écrit :
>
>
...
>You can use the ctypes.byref() function (as it is in an argulent list):
>
> ReadOPort.argtypes = (c_ushort, c_ushort, ctypes.POINTER(c_ulong) )
> ReadOPort.restype = c_short
> status = c_ulong() # status value to be read
> number = c_ushort(1) # CardNumber = 1
> port = c_ushort(11)
> rc = ReadOPort(number, port, ctypes.byref(status))
> print rc, ststus
>
>
Just as an FYI, Thomas has recently added code which does the byref
automatically. The version of ctypes in CVS HEAD will allow you to pass
in a c_ulong where the argtype is ctypes.POINTER(c_ulong).
Have fun,
Mike
--
________________________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://www.vrplumber.com
http://blog.vrplumber.com
More information about the Python-list
mailing list