It was long time ago, indeed:
https://bugzilla.gnome.org/show_bug.cgi?id=651271

Wow, how fast the time passes.

Ok, maybe I will give it another try :)

m.

2016-03-02 17:59 GMT+01:00 Ben Iofel <iofel...@gmail.com>:

> If you can make it segfault, please file a bug or at least post the code
> here
>
>
> On Wed, Mar 2, 2016, 11:09 AM mar...@saepia.net <mar...@saepia.net> wrote:
>
>> Hello,
>>
>> thank you for suggestions. I'll try to implement them.
>>
>> But should I keep it as struct or rather compact class?
>>
>> Regarding json-glib: I intentionally try to avoid it. I was able to make
>> segfault even with a few simple attempts that should be tested in properly
>> written library, I don't need mapping for GObject properties, and I think I
>> encountered also some issues with big integers, I don't remember now. In my
>> use case more low level, better-tested library will a be better choice.
>>
>> m.
>>
>> 2016-03-02 15:28 GMT+01:00 Ben <iofel...@gmail.com>:
>>
>>> FYI, Vala already has binding for json-glib
>>> http://valadoc.org/#!api=json-glib-1.0/Json
>>> It has nice features like deserialization with GObject properties
>>>
>>> On Wed, Mar 2, 2016 at 5:19 AM, mar...@saepia.net <mar...@saepia.net>
>>> wrote:
>>>
>>> Hello, I need to write VAPI for jansson JSON library. I have already
>>> started ( https://github.com/akheron/jansson/pull/273) and generally
>>> speaking it works fine but I have an issue with covering one struct. In C
>>> code there's the following struct: #define JSON_ERROR_TEXT_LENGTH 160
>>> #define JSON_ERROR_SOURCE_LENGTH 80 typedef struct { int line; int column;
>>> int position; char source[JSON_ERROR_SOURCE_LENGTH]; char
>>> text[JSON_ERROR_TEXT_LENGTH]; } json_error_t; it is an output parameter to
>>> function that should have the following syntax in Vala: loads(string input,
>>> LoadFlags flags, out Error error) I struggle to properly define it in VAPI.
>>> When I define it like this: [CCode (cname = "json_error_t", has_type_id =
>>> false)] public struct Error { public string text; public string source;
>>> public int line; public int column; public size_t position; } it complains
>>> about missing copy function during C compilation phase when I add [CCode
>>> (cname = "json_error_t", has_copy_function = false, has_type_id = false)]
>>> public struct Error { public string text; public string source; public int
>>> line; public int column; public size_t position; } it then throws
>>> api/auth/oauth2.c:939:2: error: array type 'char [160]' is not assignable
>>> _g_free0 ((*dest).text); ^ ~~~~~~~~~~~~ api/auth/oauth2.c:51:28: note:
>>> expanded from macro '_g_free0' api/auth/oauth2.c:940:15: error: array type
>>> 'char [160]' is not assignable (*dest).text = _tmp1_; ~~~~~~~~~~~~ ^
>>> api/auth/oauth2.c:943:2: error: array type 'char [80]' is not assignable
>>> _g_free0 ((*dest).source); ^ ~~~~~~~~~~~~~~ How to define it properly?
>>> Underlying API does not provide any destroy/copy functions. I also tried to
>>> convert it to the compact class but then Vala Compiler creates
>>> pointer-to-pointer for underlying C code for the parameter which is
>>> improper. Thanks, Marcin _______________________________________________
>>> vala-list mailing list vala-list@gnome.org
>>> https://mail.gnome.org/mailman/listinfo/vala-list
>>>
>>>
>>
_______________________________________________
vala-list mailing list
vala-list@gnome.org
https://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to