ctypes question about call by reference
Oliver Andrich
oliver.andrich at gmail.com
Sun Sep 24 15:09:25 EDT 2006
After a walk outside, some fresh air around my nose and some time to
relax, I finally found out how to do, what I want to do.
First, define the argument types and the result type.
_dll.MagickGetException.argtypes = (c_long, POINTER(c_long))
_dll.MagickGetException.restype = c_char_p
Second, write correct code as it is documented. :)
def get_magick_exception(wand):
severity = c_long()
description = _dll.MagickGetException(wand, byref(severity))
return (severity, description)
And thats all. I just did the call to POINTER(c_long) in the wrong
location. Now I do it as documented, and I get everything I want.
I can btw live perfectly without definining what actually a MagickWand
is, cause from the point of the developer just using the library and
documentation, he doesn't know about the actual structure of it. The
definition is hidden the C source of the library, and is not
documented in the public interface.
Thanks and Regards,
Oliver.
--
Oliver Andrich <oliver.andrich at gmail.com> --- http://roughbook.de/
More information about the Python-list
mailing list