Re: [Vala] Vapi delegate problems.



On Tue, Apr 26, 2011 at 03:50:39PM -0600, Lewis Gunsch wrote:
Hi,

I am having trouble getting a delegate in a vapi to work correctly. My
original attempt (line 70 of the vapi) did not work because of how the
typedef is in the C header (it's not a function pointer), so instead of
using their typedef I used GLib.Func which matches the function signature.
This is suppose to be (void*)(void*, void*), but Vala creates it to be
(void*)(const void*, void*) and then produces an error. The method that
produces this error is

ZMQ.MSG.Msg.data(uint8[] data, GLib.Func? ffn = null);

and the corresponding C method is

ZMQ_EXPORT int zmq_msg_init_data (zmq_msg_t *msg, void *data, size_t size,
zmq_free_fn *ffn, void *hint);

The library I'm am trying to write the vapi for is ZeroMQ. Here is a link to
zmq.h.
https://github.com/zeromq/zeromq2-1/blob/v2.1.4/include/zmq.h

You can see my attempt at the vapi below. My original delegate which I could
not get to work is on line 70.
https://github.com/lgunsch/zmq-vala/blob/msg_refactor/libzmq.vapi

And my test is here:
https://github.com/lgunsch/zmq-vala/blob/msg_refactor/examples/delegatetest.vala

Sorry if I have not explained myself in a clear manner. Help is much
appreciated!

What happens if you add [CCode (type = "(void*)(void*, void*)")] to the parameter?

-- 
http://www.debian.org - The Universal Operating System

Attachment: signature.asc
Description: Digital signature



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