[Vala] A struct in a vapi file with undefined contents?
- From: Dylan McCall <dylanmccall gmail com>
- To: vala-list gnome org
- Subject: [Vala] A struct in a vapi file with undefined contents?
- Date: Sun, 28 Jul 2013 22:28:33 -0700
Sometimes, when I find myself working with a (plain) C library through
Vala, I end up using a pattern like this. I really don't like it:
void * convert_state = Fit.create_convert_state();
Fit.Convert.init(convert_state, true);
In this case, Fit.Convert.init is part of the original library, which
I made a vapi file for. It takes a reference to convert_state, which
it writes to. Fit.create_convert_state() is a function I created in a
small C wrapper library. The entire point of it is to allocate space
for a struct on the heap (for Fit.Convert.init), and then return a
pointer to that struct. The struct isn't in the vapi file because it's
huge and complicated and it's really internal to that library. Its
contents aren't _interesting_ to the Vala program - just that it's of
a particular size.
Is there a way to add a struct with undefined contents in a vapi file?
That way I can maybe do something like this with the example?
ConvertState convert_state = ConvertState();
Fit.Convert.init(convert_state, true);
We wouldn't be able to access any members in convert_state, but we'd
be spared ugly void pointers.
…or am I looking at this the wrong way? I probably am. Any help is
appreciated :)
--
Dylan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]