I'm using cffi
to wrap a library that uses errno
to return error values.
How can I read errno
from cffi?
I'm using cffi
to wrap a library that uses errno
to return error values.
How can I read errno
from cffi?
请参阅文档https://cffi.readthedocs.org/en/release-0.6/
ffi.errno
是cffi.FFI
对象的属性。
例如
from cffi import FFI
ffi = FFI()
# error happens
print ffi.errno
ffi.errno:从该线程中最近的 C 调用接收的 errno 的值,并传递给下一个 C 调用,可通过属性 ffi.errno 的读取和写入获得。在 Windows 上,我们还保存和恢复 GetLastError() 值,但要访问它,您需要像往常一样声明和调用 GetLastError() 函数。