Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x python ctypes回调可能被忽略?_Python 3.x_Callback_Ctypes - Fatal编程技术网

Python 3.x python ctypes回调可能被忽略?

Python 3.x python ctypes回调可能被忽略?,python-3.x,callback,ctypes,Python 3.x,Callback,Ctypes,我有一个带有以下原型的c回调: typedef void(__stdcall *TUSR_ConnAckEvent)( long ReturnCode, LPCWSTR Description ); typedef long(_stdcall *FN_USR_GetVer)(); typedef boolean(_stdcall *FN_USR_Init)(LPCWSTR Host, unsigned short Port, long Ver); typedef void(_stdcall *

我有一个带有以下原型的c回调:

typedef void(__stdcall *TUSR_ConnAckEvent)( long ReturnCode, LPCWSTR Description );
typedef long(_stdcall *FN_USR_GetVer)();
typedef boolean(_stdcall *FN_USR_Init)(LPCWSTR Host, unsigned short Port, long Ver);
typedef void(_stdcall *TUSR_ConnAckEvent)(long ReturnCode, LPCWSTR Description);
typedef boolean(_stdcall *FN_USR_OnConnAck)(TUSR_ConnAckEvent OnConnAct);
typedef boolean(_stdcall *FN_USR_Connect)(LPCWSTR Username, LPCWSTR Password);
此回调函数是用户定义的

boolean USR_OnConnAck(TUSR_ConnAckEvent OnConnAct);
用户需要使用USR\u onconnect()注册回调函数,然后用户需要使用USR\u Connect()启动到服务器的连接。如果成功,回调函数应该可以工作,但它不能,现在我很困惑

我尝试了多种方法来原型化回调:

typedef void(__stdcall *TUSR_ConnAckEvent)( long ReturnCode, LPCWSTR Description );
typedef long(_stdcall *FN_USR_GetVer)();
typedef boolean(_stdcall *FN_USR_Init)(LPCWSTR Host, unsigned short Port, long Ver);
typedef void(_stdcall *TUSR_ConnAckEvent)(long ReturnCode, LPCWSTR Description);
typedef boolean(_stdcall *FN_USR_OnConnAck)(TUSR_ConnAckEvent OnConnAct);
typedef boolean(_stdcall *FN_USR_Connect)(LPCWSTR Username, LPCWSTR Password);
一,

二,

但是,在为函数实例化正确的参数和重新类型后,将永远不会调用回调。我希望有人能指出我可能犯的错误

这是我的代码:

typedef void(__stdcall *TUSR_ConnAckEvent)( long ReturnCode, LPCWSTR Description );
typedef long(_stdcall *FN_USR_GetVer)();
typedef boolean(_stdcall *FN_USR_Init)(LPCWSTR Host, unsigned short Port, long Ver);
typedef void(_stdcall *TUSR_ConnAckEvent)(long ReturnCode, LPCWSTR Description);
typedef boolean(_stdcall *FN_USR_OnConnAck)(TUSR_ConnAckEvent OnConnAct);
typedef boolean(_stdcall *FN_USR_Connect)(LPCWSTR Username, LPCWSTR Password);
(顺便说一下,我的python版本是3.6.5和32位)

这是dll文件:

以下是我使用过的所有函数原型:

typedef void(__stdcall *TUSR_ConnAckEvent)( long ReturnCode, LPCWSTR Description );
typedef long(_stdcall *FN_USR_GetVer)();
typedef boolean(_stdcall *FN_USR_Init)(LPCWSTR Host, unsigned short Port, long Ver);
typedef void(_stdcall *TUSR_ConnAckEvent)(long ReturnCode, LPCWSTR Description);
typedef boolean(_stdcall *FN_USR_OnConnAck)(TUSR_ConnAckEvent OnConnAct);
typedef boolean(_stdcall *FN_USR_Connect)(LPCWSTR Username, LPCWSTR Password);
以下是文档:

typedef void(__stdcall *TUSR_ConnAckEvent)( long ReturnCode, LPCWSTR Description );
typedef long(_stdcall *FN_USR_GetVer)();
typedef boolean(_stdcall *FN_USR_Init)(LPCWSTR Host, unsigned short Port, long Ver);
typedef void(_stdcall *TUSR_ConnAckEvent)(long ReturnCode, LPCWSTR Description);
typedef boolean(_stdcall *FN_USR_OnConnAck)(TUSR_ConnAckEvent OnConnAct);
typedef boolean(_stdcall *FN_USR_Connect)(LPCWSTR Username, LPCWSTR Password);


(这是一个中文网站,您可以使用GoolgeTranslate阅读。)

请显示您正在调用的所有函数的函数原型。它们都是u stdcall吗?是的,它们都是u stdcall。我已经更新了我的问题,您可以看到。请显示您正在调用的所有函数的函数原型。它们都是吗?是的,它们都是。我已经更新了我的问题,你可以看到。