How to transfer the full list on the pointer in function from DLL, Python?
The code works, but the wFpsCameraCreate function accepts only the first KeyMatr [1] value, and does not see the second from the list. Tell me, please, how to pass an array to a function.
from ctypes import * # give location of dll ws3d = cdll.LoadLibrary("..//WS3DCoreLib.dll") class wKeyCode(Enum): wKC_UP = 0x26 wKC_KEY_W = 0x57 class wKeyAction(Enum): wKA_MOVE_FORWARD = 0 wKA_MOVE_BACKWARD = 1 wKA_STRAFE_LEFT = 2 wKA_STRAFE_RIGHT = 3 wKA_JUMP_UP = 4 wKA_COUNT = 5 wKA_FORCE_32BIT = 0x7fffffff class wKeyMap(Structure): _fields_ = [ ("Action", c_uint32), ("KeyCode", c_uint32) ] <pre> class wNode(Structure): _fields_ = [("wNode", POINTER(c_uint32))] def wFpsCameraCreate(rotateSpeed = 100, moveSpeed = 0.1, keyMapArray = 0, keyMapSize = 0, noVerticalMovement = False, jumpSpeed = 0): ws3d.wFpsCameraCreate.restype = wNode return ws3d.wFpsCameraCreate(c_float(rotateSpeed), c_float(moveSpeed), keyMapArray, keyMapSize, noVerticalMovement, c_float(jumpSpeed)) def wKeyMapDefault(i): s = [] s.append(wKeyMap()); s.append(wKeyMap()) s[1].Action = wKeyAction.wKA_MOVE_FORWARD.value s[1].KeyCode = wKeyCode.wKC_KEY_W.value s.append(wKeyMap()) s[2].Action = wKeyAction.wKA_MOVE_FORWARD.value s[2].KeyCode = wKeyCode.wKC_UP.value return s # Create FPS-camera KeyMatr = []; KeyMatr = wKeyMapDefault(1) CameraNode = wFpsCameraCreate(100, 0.1, pointer(KeyMatr[1]), 8, False, 0) I will be grateful.