Hi, Guys
I want to write VAPI bindings for liborient [0].
While analyzing the C-code i came across the functions which turned out
to work in a somewhat unexpected way.
Usually one has some struct, methods to create and free the struct and a
set of methods that operate on that struct. Such code can be converted
to VAPI bindings in a straightforward way.
However liborient keeps managing stuff like this:
- One struct to represent a handle
- One struct to represent a connection
- A set of methods which operate on _both_ of the previously mentioned
structs.
A typical method-definition looks like this:
long o_bin_dataclustercount(orientdb *o, orientdb_con *c, struct timeval
*timeout, int nonblocking, short clusternumber);
In Vala I'd like to use the lib like this:
var handle = new OrientDB();
var connection = handle.connect("foo","bar");
connection.dataclustercount(sometimeval, 1, 1);
Under the given circumstances I have the feeling that the best thing one
can achieve is something like this:
var handle = new OrientDB();
var connection = Connection.connect(handle, "foo", "bar")
handle.dataclustercount(connection, sometimeval, 1, 1);
Am I right? Is there any possibility to cover this C-Pattern?
Second question: The library imports <sys/time.h> at some point and uses
the timeval definition from in there in method signatures. How can i
write equivalent Vala Types to write Vala signatures for them?
Thanks in Advance and a nice evening,
grindhold
Attachment:
signature.asc
Description: OpenPGP digital signature