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



Thanks pancake!
Thanks for your great example.I get it:)


2007/9/27, pancake < pancake youterm com>:
Spam detection software, running on the system "pluna", has
identified this incoming email as possible spam.  The original message
has been attached to this so you can view it (if it isn't spam) or label
similar future email.  If you have any questions, see
postmaster for details.

Content preview:  Read the archives. This is what I used to call native stuff
   from Vala: Subject: [Vala] Calling C code from Vala Date: Sat, 8 Sep 2007
   21:41:37 +0200 Looking inside the vala sources I have seen how valaparser.vala
   interacts with parser.c. It's the only place it's used the [Import ()] directive
   and imho this is a nice feature that should be documented on the wiki. (feel
   free to add this example) [...]

Content analysis details:   (3.3 points, 3.0 required)

pts rule name              description
---- ---------------------- --------------------------------------------------
4.5 HELO_LOCALHOST         HELO_LOCALHOST
0.5 RCVD_IN_PBL            RBL: Received via a relay in Spamhaus PBL
                            [85.52.227.55 listed in zen.spamhaus.org]
-1.7 AWL                    AWL: From: address is in the auto white-list




---------- 已转发邮件 ----------
From: pancake <pancake youterm com>
To: vala paldo org
Date: Wed, 26 Sep 2007 21:27:58 +0200
Subject: Re: [Vala] Help~ How to call system API like open() and socket()?
Read the archives. This is what I used to call native stuff from Vala:

Subject: [Vala] Calling C code from Vala
Date: Sat, 8 Sep 2007 21:41:37 +0200

Looking inside the vala sources I have seen how valaparser.vala interacts with parser.c.
It's the only place it's used the [Import ()] directive and imho this is a nice feature
that should be documented on the wiki. (feel free to add this example)

Here's an explanation:

$ cat foo.vala
using GLib;

public class Foo.Bar
{
        public static int main(string[] args)
        {
                hello_msg("World!");
                return 0;
        }

        [Import ()]
        public static void hello_msg(string name);
}

We define an imported static method (no need to be static, but for a simple example is ok)
on the Bar class of the Foo namespace.

Now we implement the hello_msg function in C inside bar.c:

$ cat bar.c
void foo_bar_hello_msg(void *name)
{
        printf("Name: %s\n", name);
}

That is. Quite easy :)

To build just use this Makefile:

$ valac foo.vala bar.c -o foo

$ ./foo
Hello World!


On Wed, 26 Sep 2007 15:16:47 +0800
GaoXianchao < gxcmaillist gmail com> 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.
>
> My first BitTorrent Client is bitstormlite. It's using c++ & GTK2, already
> in Debian & Ubuntu.
> My second BitTorrent Client is bitbox <http://www.bitbox.cn> . 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()?
>
> Thanks a lot!
>


  --pancake

_______________________________________________
Vala mailing list
Vala paldo org
http://www.paldo.org/mailman/listinfo/vala




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