Re: [Vala] Help~ How to call system API like open() and socket()?



Hi,

On Wed, 2007-09-26 at 15:16 +0800, GaoXianchao wrote:
Hi~
Today I found Vala. It's the dream language in my heart, I finally got
it!
I want to use Vala to make my 3rd BitTorrent client.

Nice to hear that!

My first BitTorrent Client is bitstormlite. It's using c++ & GTK2,
already in Debian & Ubuntu. 
My second BitTorrent Client is bitbox . It's based on java.

bitbox is easy to develop but need jvm and more memory. bitstormlite
is fast but development using c++ is hard. 

so I think Vala is my best selection. I have a question :
How to call system API like open() and socket()?

For each C function you want to call you need a (compile-time only)
binding in a so-called VAPI file. We have bindings for large parts of
the GNOME libraries but there are no bindings for the POSIX functions
open() and socket() at the moment, as we usually prefer functions from
GLib or higher-level libraries to make use of a object-oriented
cross-platform API.

You can now either try to start with POSIX bindings for Vala or use
another API like FileStream.open() (maps to fopen) or the GNet library,
which should allow you to create sockets. The GNet library is
unmaintained at the moment, unfortunately, so it might not be the best
choice when starting a new application.

The new gio[1] library will presumably provide a nice API for handling
I/O with streams and creating sockets. However it's still in development
and the socket API is not available yet.

Regards,

Jürg

[1] http://mail.gnome.org/archives/desktop-devel-list/2007-September/msg00401.html




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