Re: [Vala] C Integration, it's cool



Thanks Rodrigo for posting!!!

I tried your technique and i can pass at least integers and
strings (as const char*) to software written in c.  (I have
not tried sending across large amounts of data in arrays,
or anything like that.)

Is this written up on http://valadoc.org anywhere?

(I tried a very naive search on "extern" but only got External.....)
(And i guess i should point out that your decl below no
doubt was extern but dropped a character in copying.)

Anyhow, thanks again, this is a very big help to me because
the body of c code is very very large, and it is so useful
to be able to tap into it.

dan

(PS: in case it makes any difference, i'm using vala 0.14 in ubuntu 11.10.)

On Fri, Dec 16, 2011 at 10:55 AM, Rodrigo Herefeld
<rodrigo herefeld gmail com> wrote:
I've found a goodie, i needed to use libcurl in a vala program, just to
fetch a file regulary from the internet,
after some searching i end up doing that:

i write all the curl thing in a c program , then i wrote a function that
makes the connection and return
the content of the file.
in vala i wrote

exter  char[] my-curl-fun-in-c();
and called that from vala where i needed

compile like that:
valac valasource.vala csource.c -X -l curl

Wew it worked fine!!!!!

--
Rodrigo Cesar Herefeld

_______________________________________________
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]