FAQ - How do I declare that a CTypes function returns void?

p.lavarre at ieee.org p.lavarre at ieee.org
Wed Oct 25 18:54:51 EDT 2006


Now at http://pyfaq.infogami.com/suggest we have:

FAQ: How do I declare that CTypes function returns void?

A: c_void = None is not doc'ed, but is suggested by:
>>> ctypes.POINTER(None)
<class 'ctypes.c_void_p'>
>>>

Remembering c_void = c_int from K&R C often works, but if you say a
restype is c_int, then doctest's of that call will print an int, yuck.
If you say the restype is None, then those doctest's work: they print
nothing.

Hope this helps,




More information about the Python-list mailing list