argtypes
Assign a tuple of ctypes types to specify the argument types that the function accepts. Functions using the stdcall
calling convention can only be called with the same number of arguments as the length of this tuple; functions using the C calling convention accept additional, unspecified arguments as well.
When a foreign function is called, each actual argument is passed to the from_param()
class method of the items in the argtypes
tuple, this method allows adapting the actual argument to an object that the foreign function accepts. For example, a c_char_p
item in the argtypes
tuple will convert a string passed as argument into a bytes object using ctypes conversion rules.
New: It is now possible to put items in argtypes which are not ctypes types, but each item must have a from_param()
method which returns a value usable as argument (integer, string, ctypes instance). This allows defining adapters that can adapt custom objects as function parameters.
Please login to continue.