Re: [Vala] sqlite needs more love



Oh, I almost forgot, you can see the complete code here:
http://setanta-labs.googlecode.com/svn/trunk/vala/simplesqlite.vala

On Nov 9, 2007 2:14 AM, Marcelo Lira <setanta gmail com> wrote:
Hello pancake,

I was stuck with the same exec-callback problem that you have, I even think that was a bug and filled it[1]. But while looking in the Cairo bindings I found the missing part: you have to use one of these before the callback function declaration

[NoArrayLength ()]
public static int callback(pointer data, int n_columns, string[] values, string[] column_names)

It will generate the correct C code (it was inside the Demo class):

gint demo_callback (gpointer data, gint n_columns, char** values, char** column_names)

[1] http://bugzilla.gnome.org/show_bug.cgi?id=487612


On Nov 9, 2007 1:35 AM, pancake < pancake youterm com> wrote:
> So...the arguments are not shifted...but i don't know where they are :)

I saw the problem here...it's about the c conversion of string[] which is not
converted to char**...it is "int n, char **".

Vala code:

 public static int foo(pointer data, int ncols, string[] values, string[] colnames) {
   ...
 }

Generated C code:

 gint foo_bar_foo(gpointer data, gint ncols, int values_length1, char **values, int column_names_length1, char **column_names)
   ...
 }

And the one defined in sqlite3.h

 typedef int (*sqlite3_callback)(void *, int, char **, char **);

Can this be defined as a Vala attribute in the vapi? or should the valac be fixed to
handle arrays in this way?

--pancake
_______________________________________________
Vala mailing list
Vala paldo org
http://www.paldo.org/mailman/listinfo/vala



--
Marcelo Lira dos Santos
http://setanta.wordpress.com
@CInLUG: http://www.cin.ufpe.br/~cinlug
@Ciência Livre: http://www.ciencialivre.pro.br
@INdT: http://www.indt.org.br



--
Marcelo Lira dos Santos
http://setanta.wordpress.com
@CInLUG: http://www.cin.ufpe.br/~cinlug
@Ciência Livre: http://www.ciencialivre.pro.br
@INdT: http://www.indt.org.br

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