Андрей Игоревич Кучеров <z...@...> writes: > I have the simple question. Imagine That we have a vala CLI > application... [...] > > And I wand to add new method to my cli_hello class. And this method > needs the C header file... for example <sys/socket.h>, and use C > function in my Vala application. > Is it possible, how could i do that? How the code will be changed?
You need to find or write or create a .vapi file for the functions you need. The headers needed in C code are specified there, along with some other information needed by vala to correctly generate call to a C function. The socket function from sys/socket.h and the constants you need as parameters are already in posix.vapi (should be installed as /usr/share/vala/vapi/posix.vapi), but I couldn't find the rest of BSD socket API anywhere. You can use posix.vapi as a sample to add what you need. Note, that in particular case of sys/socket.h, you might want to use the GNet package instead. It's built on Glib, so it will work better with the vala type system and be more portable at the same time. And already has the vapi file. _______________________________________________ Vala-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/vala-list
