Re: [Vala] Vala and Cairo 1.12



2013/5/15 Donn <donn ingle gmail com>

 Are there a lot of new functions in 1.12 that you need? If not,
you could just inline the function signatures in your vala code
until someone updates the official vapi.

It seems Evan Nemerson is on the case - yay! - but I'd like to know a
little more about this inline thing. Do you have an example so I can get
the picture? (I'm a Pythoner who tripped over Vala and I'm still rubbing my
chin.)


It's basically the same as declaring foreign functions in C.
Let's say you want to use the function 'int cairo_do_foo()' from Vala,
you would write something like:

namespace Cairo {
    [CCode (cname="cairo_do_foo")]
    extern int do_foo();
}

The 'CCode' part is a directive to valac for how it should
output the C code. We tell it the actual C function name
to use.

Jonas


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