Re: [Vala] Sharing a trick to use some C macros in VALA



I was thinking few time ago to add language support to do this from vala using the offsetof() keyword. Will someone else find interesting such a keyword in vala? Like in sizeof()

I was needing it to use kernel's list.h

On Nov 1, 2009, at 6:00 AM, Yu Feng <rainwoodman gmail com> wrote:

Dear list,

I found this trick today, in case it is not already dinosaur..

[CCode (cname="G_STRUCT_OFFSET(MyBaseClassClass, my_function)")]
extern const int MyFunctionOffset;

basically you can call in this way any c macros that are otherwise not
directly bindable to vala, given that the return type of the macro is
known.


- Yu

_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list




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