Pointers and ctypes

rubbishemail at web.de rubbishemail at web.de
Mon Aug 29 15:19:17 CEST 2005


Hello,
i've got a problem with pointers in the following function which i want
to use:

I16 __stdcall DO_ReadPort (U16 CardNumber, U16 Port, U32 *Value)

The function is supposed to read out the status of a digital port of
analog digital interface card.
I got this function from Dask.h which came with the card. The relevant
lines concerning this function are the following:

typedef short           I16;
typedef unsigned short  U16;
typedef unsigned long   U32;

I16 __stdcall DO_ReadPort (U16 CardNumber, U16 Port, U32 *Value)

I tried to implement this function into python:
# I16 __stdcall DO_ReadPort (U16 CardNumber, U16 Port, U32 *Value);
    ReadOPort = dask.DO_ReadPort
    ReadOPort.argtypes = [c_ushort, c_ushort, c_ulong]
    ReadOPort.restype = c_short

I can't handle the pointer "Value" which should be an unsigned long
pointer. I'd be very happy, if u could give me a hint how to implement
this pointer into python.

Thanks a lot

Carlo and Pierre




More information about the Python-list mailing list