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.
Functionally, pointer
and byref
are equivalent.
However, the python docs do point out that
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.
POINTER(type)
is the equivalent of type*
in C - it's a type.