Re: [Vala] how to call extern function expecting function pointer?



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 that array.size and array.move are. But you could still
use this patch to make sort work in your own applications.

best,
Dan
___________________________
Daniel Lucraft
http://www.daniellucraft.com/



2008/12/9 Alexander Bokovoy <ab altlinux org>:
2008/12/9 Adam Dingle <adam medovina org>:
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 the same error message:

  top.c:41: error: conflicting types for 'qsort'
  /usr/include/stdlib.h:689: error: previous declaration of 'qsort' was here
You would need to define .vapi file for this particular function and
then use this VAPI.

--
/ Alexander Bokovoy
_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list




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