Re: [Vala] Creating a binding for a non-glib library and using delegate to map a function pointer



Perhaps I got the point where I was wrong.

On Fri, Mar 11, 2011 at 12:42 PM, Luca Dionisi <luca dionisi gmail com> wrote:
First pass, I prepared a direct mapping vapi.
 libfoo.vapi    [http://pastebin.com/rZb6JqAZ]
 [IMPORTANT note: if I don't miss something, I have
 [to create a delegate, named FunctionDelegate, in the vapi
 [file in order to map the function pointer argument.

Another way to do that is to define the delegate in another vala
source file and include it in the compilation where libfoo.vapi is
used.

So, use the same files described before:

 libfoo.c    [http://pastebin.com/u89bWnib]
 libfoo.h    [http://pastebin.com/kDr91Cfg]
 testfoo.c    [http://pastebin.com/UiZk6BiG]
 test_foo.vala    [http://pastebin.com/6ecJLpic]
 libwrapfoo.vala    [http://pastebin.com/z2JExW4v]
 test_oo_foo.vala    [http://pastebin.com/XiAGk9Ww]

But... use these new ones:

 libfoo.vapi    [http://pastebin.com/HJ2NMzRn]
 use_with_libfoo.vala    [http://pastebin.com/HwNY6d0K]

<Use the commands here http://pastebin.com/ev2dF8KK>

The I can issue the following commands:

<Use the commands here http://pastebin.com/2dfvzW1s>
And they all go right.

Further, I can issue the following:

<Use the commands here http://pastebin.com/tz886k9y>
And I can code in oo-style without directly reference the old library.



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