[Vala] extern variable



Hi,

Seams there is a problem defining variable in a separate .c file:

I use the following code:

---------main.c
using GLib;

public extern string s;

public static void main(string[] args) {

        message(s);
}

--------variable.c
#include "variable.h"

--------variable.h
const char* s = "value";

I compile adding the variable.c to the sources to compile,
but compilation fails with:

/Temp/ccXQlAqT.o:h.c:(.data+0x0): multiple definition of `_s'
/Temp/ccIcEsuT.o:main.c:(.bss+0x0): first defined here

And in indeed s is also defined
in
main.c
as
char* s = NULL;

If I remove that, everything compiles  and runs fine.

Is this a bug?(vala 0.5.4)
MihailNaydenov




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