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



To get some of these tricks to work it would be helpful to be able to pass the  C type underlying the vala 
type as a macro parameter.

I've a bug with patches that does this using typeof() to emit the C typesymbol but it doesn't meet Juerg's 
syntax expactations.

As interfacing with c macros is topical again, does anyone have ideas on this?

Sam

-----Original Message-----
From: pancake <pancake youterm com>
Sent: 01 November 2009 10:29
To: Yu Feng <rainwoodman gmail com>; vala-list gnome org
Subject: 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

_______________________________________________
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]