ctypes对共享库类和函数原型使用参数之间的区别?

2024-09-24 08:28:19 发布

您现在位置:Python中文网/ 问答频道 /正文

{{{cd3}{cd3}function prototypes,CFUNCTYPEWINFUNCTYPE。我什么时候把use_errno=True传给哪一组?为什么?在


Tags: trueusefunctionprototypeserrnocfunctypecd3winfunctype
1条回答
网友
1楼 · 发布于 2024-09-24 08:28:19

这是包含的bug tracker

This patch adds new calling conventions to ctypes foreign functions by passing 'errno=True' or 'GetLastError=True' to the CDLL or WinDLL constructor.

If CDLL(..., errno=True) or WinDLL(..., errno=True) is used, the function objects available in the CDLL or WinDLL instance will set the C global errno to zero before the actual call, and attach the C global errno value after the call as 'errno' attribute to the function object. This attribute is stored in thread-local storage.

相关问题 更多 >