ctypes.pointer,ctypes.POINTER和ctypes.byref有什么区别? [英] What is the difference between ctypes.pointer, ctypes.POINTER, and ctypes.byref?
本文介绍了ctypes.pointer,ctypes.POINTER和ctypes.byref有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在ctypes中,指针和BYREF有什么区别?两者似乎都是将指针传递给函数的一种方法,例如作为输出参数。
In ctypes, what is the difference between pointer and byref? They both seem like a way to pass a pointer to a function, for example as an output parameter.
推荐答案
从功能上讲,它们是
但是, python文档确实指出,
pointer由于构造了一个真正的指针对象而做了很多工作,因此如果不需要该指针对象,使用byref会更快。在Python本身中。
pointer does a lot more work since it constructs a real pointer object, so it is faster to use byref if you don't need the pointer object in Python itself.
这篇关于ctypes.pointer,ctypes.POINTER和ctypes.byref有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文