After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 487612 - SQLite bindings generate callback with wrong signature
SQLite bindings generate callback with wrong signature
Status: RESOLVED NOTABUG
Product: vala
Classification: Core
Component: Bindings
0.1.x
Other All
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2007-10-17 19:23 UTC by Marcelo Lira
Modified: 2007-11-09 05:00 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Marcelo Lira 2007-10-17 19:23:23 UTC
Please describe the problem:
The sqlite bindings declare the parameter signature for the callback function as:

public static delegate int Callback (pointer data, int n_columns, string[] values, string[] column_names);

and the original C callback is:

static int callback(void *data, int n_columns, char **values, char **column_names);

But the C code generated by valac is like this:

static int callback(void *data, int n_columns, int values_length, char **values, int column_names_length, char **column_names);

Note: may be not exactly like this, i'm far from my computer right now, but the idea is that string arrays generate 2 parameters, namely: "char **array" and "int array_length", which breaks the signature expected by the binded C library.

Steps to reproduce:


Actual results:


Expected results:


Does this happen every time?


Other information:
I tried to use [NoArrayLength] in my callback declaration, but without success.
Comment 1 Marcelo Lira 2007-11-09 05:00:08 UTC
It was not a bug. To generate a callback function with the right signature I just have to use the NoArrayLength property in the correct manner:

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

the lines above will generate the correct C function signature:

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