A function called from a DLL returns a pointer to the structure.

How to get this structure and its data in Python?

from ctypes import * # give location of dll wsd = cdll.LoadLibrary(".//CoreLib.dll") class wGuiEvent(Structure): _fields_ = [ ("id", c_int32), ("name", c_uint32), ("event", c_uint32), ] GUIEvent = wGuiEvent() ??? GUIEvent = wsd.wGuiReadEvent() ??? GUIEvent.event ??? ??? 

    1 answer 1

    First you need to decide on the "function called from the DLL". What kind of function should return the structure you did not specify, as well as the library used. Google for the query "wGuiEvent" brought me here , from this and I will build on assumptions.

     wsd = CDLL.LoadLibrary(".//CoreLib.dll") class wGuiEvent(Structure): _fields_ = [ ("id", c_int32), ("name", c_uint32), ("event", c_uint32), ] wsd.wGuiReadEvent.restype = POINTER(wGuiEvent) guiEvent = wsd.wGuiReadEvent()