On Sun, Jan 02, 2011 at 20:44:24 +0100, Marco Trevisan (Treviño) wrote:
> Hello, I'm writing a small VAPI file for a GNU hader that requires to be
> included as:
>
> #define _GNU_SOURCE
> #include <header_file.h>
>
> Of course I can't do it nor in vala or vapi files, but to compile the
> code I have (avoiding the linker errors) I need to define _GNU_SOURCE...
>
> A solution is running valac as:
>
> valac myfile.vala -X -D"_GNU_SOURCE"
>
> but, could be added a better way to perform this? Automatizing such
> thing when including a GNU file...
If the header can't be used without this define, the library the header is
from should define it in it's pkg-config file in CFLAGS.
Whenever you give vala the '--pkg mypackage' option, it does two things:
- loads mypackage.vapi
- AND adds output of 'pkg-config --cflags mypackage' to C compiler
command line and output of 'pkg-config --libs mypackage' to linker command
line.
So the mypackage.pc somewhere on pkg-config's path should contain appropriate
definition.
So if this comes from 3rd party library, discuss adding the define -- or
avoiding the need for it -- with upstream.
--
Jan 'Bulb' Hudec <[email protected]>
_______________________________________________
vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list