[Vala] [newbie] Creating a VAPI for a raw C library



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);

As I said, I did initial VAPI mapping, but I encounter difficulties.
How to declare something to map lib_type_t?
How to play with lib_type_t variable, sometime passed by value and
sometime by reference?
How to receive string result value passed as parameter?
I tried:
string val = null;
MyLib.get(p, val);
But vala complains about passing reference and value.

I'm quite sure my questions are trivial, but it is hard to find the
rigth example for a beginer. I will appreciate any pointer to an
existing .vapi solving such problems. Or a well finished .vapi :-)

The library I'm trying to bind:
http://quvi.sourceforge.net/
API: http://quvi.sourceforge.net/html/quvi_8h.html
Example: http://quvi.sourceforge.net/html/simple_8c-example.html

Best regards,
-- 
Guilhem BONNEFILLE
-=- JID: guyou im apinc org MSN: guilhem_bonnefille hotmail com
-=- mailto:guilhem bonnefille gmail com
-=- http://nathguil.free.fr/



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