I am trying to write python code to call dll functions and am stuck in the function below, which I assume is related to the typedef callback function or function pointer function.
I tested the code below when the callback function is called, python crashes (Window notification - python.exe stops responding) without msg debugging.
I am deeply confused, any help would be appreciated :)
Thanks!
WITH
#ifdef O_Win32 #ifdef P_EXPORTS #define API __declspec(dllexport) #else #define API __declspec(dllimport) #endif
Python:
from ctypes import * def StatusCB(nErrorCode, nSID, pArg): print 'Hello world' def start(): lib = cdll.LoadLibrary('API.dll') CMPFUNC = WINFUNCTYPE(c_int, c_int, c_void_p) cmp_func = CMPFUNC(StatusCB) status_func = lib.GetStatus status_func(cmp_func)
source share