Re: [Vala] Problem creating VAPI file for XcbIcccm



On Thu, 2013-12-12 at 23:20 +0100, rastersoft wrote:
Hi all:

I'm creating a VAPI file for xcb_icccm and I have a problem:

I defined the function xcb_icccm_get_wm_class_from_reply as:

     [CCode (cname = "xcb_icccm_get_wm_class_from_reply")]
     public void get_wm_class_from_reply(out WmClassFromReply reply, 
GetPropertyReply input);

Unfortunately, when I try to compile a program that uses it, I receive 
this error:

     CMakeFiles/valawm.dir/window.c.o: In function 
`vala_wm_vala_window_map_request':
     window.c:(.text+0xbca): undefined reference to 
`xcb_icccm_wm_class_from_reply_destroy'
     window.c:(.text+0xc6e): undefined reference to 
`xcb_icccm_wm_class_from_reply_destroy'
     collect2: error: ld returned 1 exit status

It seems that Vala presumes that there must be a "destroy" call that 
complements the "get" call. But there is no such call.

How can I fix this?

You didn't provide enough information for a definitive answer, but a few
possibilities:

Vala only defaults to lower_case_cprefix_destroy; if there is a destroy
function under some other name, you should use the destroy_function
CCode annotation to specify it.

If all fields are either unowned, simpletype structs, or structs which
conform to the aforementioned constraints, vala should not generate a
call to a destroy function.  If you're not supposed to call a function
to destroy the struct at the C level but vala is generating one, odds
are good there is an error in the ownership of the fields in your vapi.

If the memory is managed elsewhere, make the out parameter unowned.


-Evan

Attachment: signature.asc
Description: This is a digitally signed message part



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