tags:

views:

84

answers:

2

I need to use the Sqlite vapi without any depedence on GLib. SQlite is non-gobject library, so it should be possible to do that.

However, when I try to compile the following file with the --profile posix option,

using Sqlite;

void main() {
    stdout.printf("Hello, World!");
}

I get am error messages:

sqlite3.vapi:357.56-357.59: error: The symbol `GLib' could not be found
  public int bind_blob (int index, void* value, int n,
GLib.DestroyNotify destroy_notify);
                                                       ^^^^
sqlite3.vapi:362.68-362.71: error: The symbol `GLib' could not be found
  public int bind_text (int index, owned string value, int n = -1,
GLib.DestroyNotify destroy_notify = GLib.g_free);
                                                                   ^^^^
sqlite3.vapi:411.42-411.45: error: The symbol `GLib' could not be found
  public void result_blob (uint8[] data, GLib.DestroyNotify?
destroy_notify = GLib.g_free);
                                         ^^^^
sqlite3.vapi:420.59-420.62: error: The symbol `GLib' could not be found
  public void result_text (string value, int length = -1,
GLib.DestroyNotify? destroy_notify = GLib.g_free);
                                                          ^^^^
Compilation failed: 4 error(s), 0 warning(s)

It seems that several of the functions defined in the sqlite vapi make references to the GLib.g_free and GLib.DestroyNotify symbols. Are there any posix alternatives to those?

+1  A: 

That should be fairly simple to solve, and I can imagine several solutions.

It boils down to declaring a different delegate void DestroyNotify (void* data) (either in the posix.vapi or sqlite3.vapi) and bind free() in posix.vapi.

The problem is the namespace, and you might need to file a bug and discuss it with the developers. If you want to avoid this problem and are ready to go with a workaround, just create a mini glib.vapi GLib namespace, where you bind only the DestroyNotify() and g_free() (binding to libc/posix free).

I would think that sqlite3 should not use GLib, but rather libc/posix, so you should be fine by modifying only posix.vapi and sqlite3.vapi and filing a bug with your patch (awesome, a contrib!).

elmarco