Re: [Vala] Thanks + Multiple C header files?



Jürg Billeter wrote:
my_string.skip certainly won't work, that's something completely
different. The array cast might work in the write_chars case.

GLib has a funcion called g_strdelimit() for substituting multiple delimiter chars with another delimiter. I would like to use it, but I can't find it in the vapi-definitions of GLib. Has it been forgotten?

g_strdelimit is a bit problematic as it modifies the string in-place
while Vala usually assumes that strings are immutable. We should
probably add a new attribute to support such functions, so that Vala can
automatically copy the string where necessary. Please open a bug about
this.

It should be possible to accomplish the same with g_strsplit_set and
g_strjoinv in the meantime.

Thank you. I have filed a feature request.

Another question. :)

Is it possible to include multiple C header files by a vapi definition, even though all the needed functions are defined in one of those header files?

I created a vapi definition which looks like this:

[CCode (cprefix="XF86VidMode", cheader_filename="X11/extensions/xf86vmode.h")]
namespace XF86VidMode {
...
}

But to compile correctly the C source file must have the following includes:

#include <X11/Xlib.h>
#include <X11/extensions/xf86vmode.h>

exactly in this order (Xlib.h first), even though I don't make any use of Xlib.h functions.


PS: PolicyKit bindings would be great in the future. I would do it myself but I'm not yet familiar enough with vapi and vala-gen-introspect.

Thank you for this great project! Vala is my portal to GNOME programming.


Regards,

Frederik



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