On Wed, 2013-11-06 at 13:12 +0100, Jason Scurtu wrote:
Hi @All, I am new to vala programming, currently I am toying with the language and I must say I am impressed and I am having alot of fun. I am currently looking for a way to use a library that was written in plain C within Vala. The library is lib5250 from the tn5250 project. I want to include all .c and .h files in my project and access the functions from Vala. How to do that and what options I have? I read about creating a .vapi file, but I haven't found any clear documentation or tutorials that gave me the ahha effect.
https://wiki.gnome.org/Vala/LegacyBindings I'm not sure it's something you really learn by reading... you pretty much need to pick a library (which you have) and just work your way through it. If you have specific questions, you can ask here or on #vala on irc.gnome.org. To get you started: [CCode (cheader_filename = "tn5250/tn5250.h")] namespace Tn5250 { [CCode (destroy_function = "tn5250_buffer_free")] public struct Buffer { [CCode (array_length_cname = "len")] public uint8[]? data; public int allocated; public Buffer (); public void append_byte (uint8 b); public void append_data (uint8[] data); public void log (string prefix); } } -Evan
Attachment:
signature.asc
Description: This is a digitally signed message part