ctypes question about call by reference

Oliver Andrich oliver.andrich at gmail.com
Sun Sep 24 12:28:16 EDT 2006


On 9/24/06, Lawrence Oluyede <rhymes at myself.com> wrote:
> Oliver Andrich <oliver.andrich at gmail.com> wrote:
> > - ExceptionType is an enum
> > - MagickWand is somewhat strange, but so far it works fine without any
> > type mangling.
> >
> > How would I wrap this thing using ctypes? Can anybody help me with that?
>
> First thing first: you have to identify how ExceptionType and MagickWand
> are composed of. Then you can start wrapping them following the
> instructions in the tutorial:
> http://docs.python.org/lib/ctypes-ctypes-tutorial.html

Well, what I learned so far from the documentation, which I already
have read more then once today, is that there is no example for an
enum in this situation. But looking at pygame-sdl and another project,
it looks like the enum is just an c_int or c_long.

And concerning MagickWand, I think I have learned, that I don't need
to define the structure, if I don't want to access it. And I don't
want to, cause this is handled by the library itself. Another point in
this context is also, that it is not defined in the header files
distributed with the library, but only in the source from which the
library is built. As the file is named magick-wand-private.h it is
also not meant to be edited.

Is it at all possbile to use a struct without defining it with ctypes?
Is it okay, to just use the int which is returned by default? Most of
my library works with that configuration, so I thought it is working.

Based on this, can you give me some more hints?

Best regards,
Oliver


-- 
Oliver Andrich <oliver.andrich at gmail.com> --- http://roughbook.de/



More information about the Python-list mailing list