Hi Adam
I posted some code a few weeks ago on this list of how to call qsort:
http://mail.gnome.org/archives/vala-list/2008-November/msg00110.html
Juergbi said that using a VAPI wasn't going to be how we eventually
have sort in Vala, rather it would be implemented by the compiler in
the same way
2008/12/9 Adam Dingle <[EMAIL PROTECTED]>:
>> You should declare your delegate static...
>
> Aha - I see. I've now declared a static delegate, and Vala now generates
> the following C code:
>
> typedef gint (*CompareFunc) (void* a, void* b);
> static void qsort (void* base, gsize count, gsize
> You should declare your delegate static...
Aha - I see. I've now declared a static delegate, and Vala now
generates the following C code:
typedef gint (*CompareFunc) (void* a, void* b);
static void qsort (void* base, gsize count, gsize size, CompareFunc f);
Unfortunately I still receive
Adam Dingle schrieb:
> [...]
> So: is there some attribute I can apply to the extern declaration that
> will cause Vala to generate a compatible function prototype? Or should I
> instead write some C code to wrap qsort() into a C function which Vala
> can call more easily? Thanks for any advice -
>
I'm trying to call the C library function qsort() from Vala. I tried this:
delegate int CompareFunc (void* a, void* b);
extern void qsort(void *base, size_t count, size_t size, CompareFunc f);
Vala accepts that, but then C compilation fails with the following:
top.c:41: error: conflicting types