Patch for Vala Binding

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
bow_der_kleine
Posts: 1
Joined: 2013-01-12T04:17:02-07:00
Authentication code: 6789

Patch for Vala Binding

Post by bow_der_kleine »

Now, we are developing a binding of MagickWand for programming language Vala (live.gnome.org/Vala/) a relative promised language. Vala-compiler compiles Vala code into C code and we can further use C code. For the compilation from C code to object file, it need a memory size of any struct for memory allocation. However the type MagickWand does not have any structure to give the size of memory allocation. Hence, an error occurs by using MagickWand without pointer. E.g., Vala generates C-code like :

MagickWand _tmp2_;

To solve this problem, it is really simple and works out of the box. We edit MagickWand.h from :

typedef struct _MagickWand
MagickWand;

to :

typedef struct _MagickWand{}
MagickWand;

and everything is done.

Now, we are using this code for our internal patch. And it would be very nice, if the patch is added to the trunk of ImageMagick.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Patch for Vala Binding

Post by magick »

When we add your patch, we get:
  • make[2]: Entering directory `/home/cristy/ImageMagick-6.8.1-9'
    CC MagickWand/MagickWand_libMagickWand_Q16_la-deprecate.lo
    In file included from MagickWand/deprecate.c:45:0:
    ./MagickWand/magick-wand-private.h:32:8: error: redefinition of 'struct _MagickWand'
    In file included from ./MagickWand/studio.h:204:0,
    from MagickWand/deprecate.c:43:
    ./MagickWand/MagickWand.h:144:16: note: originally defined here
    In file included from MagickWand/deprecate.c:45:0:
    ./MagickWand/magick-wand-private.h:33:1: error: expected identifier or '(' before '{' token
    make[2]: *** [MagickWand/MagickWand_libMagickWand_Q16_la-deprecate.lo] Error 1
rebel
Posts: 1
Joined: 2013-01-18T10:00:09-07:00
Authentication code: 6789

Re: Patch for Vala Binding

Post by rebel »

I signed up just to comment on how awesome ImageMagick bindings for Vala would be. Hope you'll get this to work, looking very much forward to it.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Patch for Vala Binding

Post by magick »

Not much we can do here. The suggested patch causes a compile error when building ImageMagick. Instead any bug report should go to the Vala developers. It should bind with any proper C syntax.
Post Reply