Re: [Vala] [newbie] Creating a VAPI for a raw C library
- From: Jens Georg <mail jensge org>
- To: vala-list gnome org
- Subject: Re: [Vala] [newbie] Creating a VAPI for a raw C library
- Date: Mon, 28 Feb 2011 11:26:23 +0200
On Mon, 2011-02-28 at 09:09 +0100, Guilhem Bonnefille wrote:
Hi all,
It's my first post on this list, as I've just decided to experiment vala.
My idea is to build a software around a C library. But, this library
is in the pure C spirit:
- opaque public types
- return values via parameters
- huge mix with value and references
I tried to initiate a .vapi, but it is quite complex for a newbie like
me. So, I'm looking for some help, and post here.
I think I have two dificulties that I can summarize with the following code:
/* API */
typedef void*lib_type_t;
void init(lib_type_t *p);
void get(lib_type_t p, char **val);
/* USE */
...
lib_type_t myType;
char *val;
lib_init(&myType);
lib_get(myType, &val);
(take with a grain of salt, typed from memory)
[CCode (c_prefix="lib_")]
namespace MyLib {
[Compact]
[CCode (c_prefix="lib_")]
class MyType {
static void init (out MyType instance);
int @get(out string val);
}
}
MyType foo;
string val;
MyType.init(out foo);
foo.get(out val);
You should have a look at the SQLite vapi.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]