Re: [Vala] Strange Behaviour?



On 06/27/2012 11:12 AM, Nor Jaidi Tuah wrote:

That sounds reasonable - I don't know the MySQL API, but I had  a quick
look at the C API docs and it they don't say that the user has to clean
up the returned pointers, which implies that the library takes care of
it, which means it's only safe to use the result immediately after
obtaining it.

The usual way to use an API like this is to go through the results in a
loop and save the data you need in your own data structures.

I thought the usual way in vala is to wrap it
in vala-style "memory management". Maybe it is
not possible in this case.

If it was the kind of API where the user, in C, is required to call a clean-up function, then yes, Vala does that for you. Here, the return value is a weak reference in Vala, which is probably the closest you'll get without writing an actual wrapper library in Vala (instead of simply using an API definition file)


hand
Nor Jaidi Tuah


_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list






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