[Vala] Binding a function that return a structure, not a pointer




I'm creating a vapi for libexif (using vala-gen-introspect) which includes a function that returns a structure:

typedef struct {ExifLong numerator; ExifLong denominator; }ExifRational;
ExifRational exif_get_rational (const unsigned char *b, ExifByteOrder order);

If I don't alter ExifRational in my .metadata, the C compiler complains about assigning ExifRational to ExifRational * when I try to use the function.

If I set ExifRational is_value_type="1", which I believe I should be, valac is generating an additional parameter (a pointer to a temporary ExifRational) when calling exif_get_rational() - of course the compiler complains at this also.

This seems like a newbie question, but I've been unable to find any similar examples in the existing bindings, so any help would be appreciated.

Thanks


-Darren




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]