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

2011-12-18 Thread Giulio Paci
Il 17/12/2011 22:01, Evan Nemerson ha scritto: On Sat, 2011-12-17 at 14:46 +0100, Giulio Paci wrote: Il 16/12/2011 19:55, Rodrigo Herefeld ha scritto: 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

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

2011-12-17 Thread Andrea Bolognani
On Fri, Dec 16, 2011 at 07:17:11PM -0800, Dan Hitt wrote: 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.) You don’t have to worry about

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

2011-12-17 Thread Giulio Paci
Il 16/12/2011 19:55, Rodrigo Herefeld ha scritto: 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

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

2011-12-17 Thread Evan Nemerson
On Sat, 2011-12-17 at 14:46 +0100, Giulio Paci wrote: Il 16/12/2011 19:55, Rodrigo Herefeld ha scritto: 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

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

2011-12-17 Thread Serge Hulne
isn't that a source of memory leak? In the example provided by Rodrigo, where a C external function is called directly from Vala code as such, (i.e. without ensuring that the (memory allocated to the) string returned by the external function is automatically managed by the glib Object model)

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

2011-12-17 Thread Serge Hulne
The following example seems to indicate that it is safe to call an external function written in C, from a Vala source code, as long as the calling Vala code knows how to free the memory associated with type of the return value yielded by the C function. I am not sure this is true irrespectively

[Vala] C Integration, it's cool

2011-12-16 Thread Rodrigo Herefeld
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

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

2011-12-16 Thread Dan Hitt
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