Re: [Vala] Generating bindings for non-GLib/GObject based API



Hi,

2010/4/22 Michael Wild <themiwi users sourceforge net>:
Hi all

I am currently trying to generate bindings for a API which has some
peculiarities which I can't seem to find any solution for.

1) Constructor function: Say I would like to use a C function as the constructor for a class (as e.g. 
newwin is used in curses.vapi). However, that C function does not return the allocated and initialized 
object in the return value, but as the first argument. The return value is an error code instead. How would 
I handle this?
I don't understand this, does the function still alocate the instance,
or does it just initialize it?

2) Delegates: The C API defines a number of callback functions, most of which take some user-defined data 
as an argument one registers along with the callback function. However, the user data is often neither the 
first nor the last argument. How can I wrap this?
[CCode (instance_pos=)]
you can use things like 3.1 for "after the 3rd argument" and 3.9 for
"before the 4th argument"

3) Is there any comprehensive attributes reference somewhere? The Vala reference (draft version) doesn't 
really say much, and actually seems to be quite a bit stale.

Some time ago, someone posted a "work in progress" here [1], not sure
if it has been added to the wiki or something.

Regards,
Abderrahim

[1] http://mail.gnome.org/archives/vala-list/2009-December/msg00019.html



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