Форум сайта python.su
Привет всем.
Приключения с языком продолжаются.
Подключил библиотеку, следую по описанию:
GetNumDevices
Description:
This function returns the number of devices connected to the host.
Prototype:
STATUS GetNumDevices (LPDWORD NumDevices)
Parameters:
1. NumDevices—Address of a DWORD variable that will contain the number of devices connected on return.
2.2 Return Value: STATUS = SI_SUCCESS or
SI_DEVICE_NOT_FOUND or
SI_INVALID_PARAMETER
#!/usr/bin/python import ctypes DWORD = ctypes.c_ulong LPDWORD = PDWORD = ctypes.POINTER(DWORD) HANDLE = ctypes.c_void_p mylib = ctypes.cdll.LoadLibrary('./lib/mylib.so') numdev = LPDWORD a = mylib.GetNumDevices(numdev) print a print numdev print "The End."
/py/mod#
./index.py
Traceback (most recent call last):
File "./index.py", line 17, in <module>
a = mylib.GetNumDevices(numdev)
ctypes.ArgumentError: argument 1: <type 'exceptions.TypeError'>: Don't know how to convert parameter 1
Отредактировано laa88rf (Авг. 1, 2013 10:53:26)
Офлайн
Наверно так надо:
numdev = DWORD(0) a = mylib.GetNumDevices(ctypes.byref(numdev))
Офлайн