* Sam Liddicott wrote, On 15/07/08 13:03:
* Jürg Billeter wrote, On 15/07/08 11:47:
On Tue, 2008-07-15 at 07:55 +0100, Sam Liddicott wrote:
...
The first struct I intend to wrap is struct ntvfs_ops, as that struct
define my base object; see:
http://gitweb.samba.org/?p=samba.git;a=blob;f=source/ntvfs/ntvfs.h;h=5de8a8b6491cd7e0f81915907de5b4fbc8153a47;hb=v4-0-test#l43
It IS a virtual method table, which a particular module has to fill in
with all the methods:
http://gitweb.samba.org/?p=samba.git;a=blob;f=source/ntvfs/cifs/vfs_cifs.c;h=844fa11cc5f584df597b0c791386b07354d08c98;hb=v4-0-test#l1089
but more complicatedly, along with a couple of attributes (ops.name,
ops.type).
It is registered on line 1137
So I don't know where to start to wrap this, to be able to tell vala
where to store the methods compatibly with samba.
That seems like you want support for virtual methods in compact classes
or maybe something like compact interfaces.
Yeah, interfaces did come to mind after I wrote that.
Not sure to what extent we
want to support this. If you have concrete proposals, how Vala could
support this without being specifically tied to how the ntvfs_ops struct
works, we can certainly discuss this.
I think I am looking for some [CCode] directives that allow me to
specify the storage of the method table and names of entries within it.
It should be possible to bind and use ntvfs_ops by declaring a delegate
for each vfunc type and adding a field for each vfunc to the bound
struct/class. You'd have to manually connect the delegates in some init
functions, then, just like in C, i.e. you can't use `override` like
that.
The less exciting way :-)
I think the first way was best; I like the _*_class_init to fill in the
method table for me.
I realised that I had misunderstood some vala docs.
I thought that only vala classes descended from glib.Object were glib
managed, but it seems that all vala classes are managed by glib.
However it's only vala-declared classes that are managed by glib; so
I'll be playing to wrap the samba structs in vapi files and see how far
I get.
Sam
|