Re: [Vala] [Genie] valac 0.8.x bug with const arrays?
- From: Arc Riley <arcriley gmail com>
- To: vala-list <vala-list gnome org>
- Subject: Re: [Vala] [Genie] valac 0.8.x bug with const arrays?
- Date: Mon, 17 May 2010 00:50:18 -0400
Oops, sorry, the .c file line 134 has nothing to do with this.
I reverted back to 0.7.10 and confirmed, this code compiles fine until
0.8.0.
On Mon, May 17, 2010 at 12:17 AM, Arc Riley <arcriley gmail com> wrote:
The following (pretty much a direct copy from http://live.gnome.org/Genie)
worked in 0.7.10 but not 0.8.0 or 0.8.1:
class Options : Object
config : static string = "config.xml"
version : static bool
license : static bool
const entries : array of OptionEntry = {
{ "config", 'c', OptionFlags.IN_MAIN,
OptionArg.FILENAME, ref config,
"Use alternative configuration", "FILE" },
{ "license", 'L', OptionFlags.IN_MAIN,
OptionArg.NONE, ref license,
"Print software license and exit", null },
{ "version", 'V', OptionFlags.IN_MAIN,
OptionArg.NONE, ref version,
"Print version information and exit", null },
{null} }
init
// parse args to options
var options = new Options ()
try
var opt_context = new OptionContext ("")
opt_context.set_help_enabled (true)
opt_context.add_main_entries (options.entries, null)
opt_context.parse (ref args)
except e:OptionError
return
The error that I get:
[1/4] valac: src/init.gs src/sockets.gs -> build/default/src/init.c
build/default/src/sockets.c
[2/4] cc: build/default/src/init.c -> build/default/src/init_1.o
default/src/init.c: In function ‘_vala_main’:
default/src/init.c:134: warning: passing argument 1 of ‘g_free’ discards
qualifiers from pointer target type
/usr/include/glib-2.0/glib/gmem.h:52: note: expected ‘gpointer’ but
argument is of type ‘const char *’
default/src/init.c:134: warning: passing argument 1 of ‘g_free’ discards
qualifiers from pointer target type
/usr/include/glib-2.0/glib/gmem.h:52: note: expected ‘gpointer’ but
argument is of type ‘const char *’
[3/4] cc: build/default/src/sockets.c -> build/default/src/sockets_1.o
[4/4] cc_link: build/default/src/init_1.o build/default/src/sockets_1.o ->
build/default/src/server
default/src/init_1.o: In function `_vala_main':
init.c:(.text+0x83): undefined reference to `OPTIONS_entries'
collect2: ld returned 1 exit status
As you can see, it compiles (with warnings, line 134 is "{ "config", 'c',
OptionFlags.IN_MAIN,") but fails on linking, apparently because
Options.entries didn't get into the object file.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]