[Vala] Vapi delegate problems.



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!

-- 
Thanks,
~Lewis


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