From 23498e85b63bc42d2f7240b9c19cd5a02d47e86d Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Thu, 21 Jul 2011 11:00:12 -0700 Subject: [PATCH] sqlite: more windows work. not quite working yet. Change-Id: I2f724ef8a923497d6d10d2aa2079d0c62c79b55f --- misc/sqlite/go-sqlite.h | 3 ++- misc/sqlite/sqlite.go | 5 ++++- misc/sqlite/vfs.c | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/misc/sqlite/go-sqlite.h b/misc/sqlite/go-sqlite.h index 562161079..810c5e5d7 100644 --- a/misc/sqlite/go-sqlite.h +++ b/misc/sqlite/go-sqlite.h @@ -1,5 +1,6 @@ #if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) -# error Not working on Windows yet +# define __USE_MINGW_ANSI_STDIO 0 +# include #elif defined(__unix__) # define SQLITE_OS_OTHER 1 #else diff --git a/misc/sqlite/sqlite.go b/misc/sqlite/sqlite.go index 4d2d6170f..d282e9b7f 100644 --- a/misc/sqlite/sqlite.go +++ b/misc/sqlite/sqlite.go @@ -3,9 +3,12 @@ package sqlite /* #cgo linux CFLAGS: -D_GNU_SOURCE -D_XOPEN_SOURCE=500 #cgo linux LDFLAGS: -lpthread +#cgo windows CFLAGS: -D_GNU_SOURCE +#cgo windows LDFLAGS: -lpthread -lgcc_s -lmingwex -lmsvcrt + +#include "go-sqlite.h" #include -#include "go-sqlite.h" static int my_bind_text(sqlite3_stmt *stmt, int n, char *p, int np) { return sqlite3_bind_text(stmt, n, p, np, SQLITE_TRANSIENT); diff --git a/misc/sqlite/vfs.c b/misc/sqlite/vfs.c index 9954e66bf..b82d20b22 100644 --- a/misc/sqlite/vfs.c +++ b/misc/sqlite/vfs.c @@ -1,11 +1,11 @@ +#include "go-sqlite.h" + #include #include #include #include "_cgo_export.h" -#include "go-sqlite.h" - static sqlite3_io_methods g_file_methods; typedef struct GoFile GoFile;