Приключения с языком продолжаются.
Подключил библиотеку, следую по описанию:
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
Вот скажите, что тут не так?
Как передать этот параметр из ф-ции в переменную?
ЗЫ. Если я параметр numdev не передаю, то мне просто возвращает в a - 0 (SI_SUCCESS)