Re: [Vala] Inline C



On Jan 25, 2008 1:02 AM, Mikael Hermansson <mike tielie gmail com> wrote:
Hello!

Is it possible to have "inline" C code in vala if not it would be great
too have it.

For example right now i need too use mysql in vala...



You can use an
[Import]
public static my_external_function(...)

or
[Import]
public my_external_member_function(...) // this one has to have the
self* pointer as first parameter, in C

to link with a function written in C in another .h/.c
Also, you might need [NoArrayLength] if you pass arrays and the
'imported' function doesn't have, for each Vala string[] parameter an
(int length, char**) sequence of parameters.

Also, you could try writing a .vapi file i guess - I don't know
exactly how but the examples are plently.

Vlad



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