From 691a8a9de39861ab7f63b5a92d0c5cbf610f3049 Mon Sep 17 00:00:00 2001 From: mattn Date: Wed, 28 Aug 2013 14:46:33 +0900 Subject: [PATCH] Use sqlite3.c in all platforms --- example/extension/extension.go | 2 +- ...{sqlite3_mod_regexp.c.example => sqlite3_mod_regexp.c} | 8 ++++++-- sqlite3_windows.c => sqlite3.c | 0 sqlite3_other.go | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) rename example/extension/{sqlite3_mod_regexp.c.example => sqlite3_mod_regexp.c} (84%) rename sqlite3_windows.c => sqlite3.c (100%) diff --git a/example/extension/extension.go b/example/extension/extension.go index f58ea3a..61ceb55 100644 --- a/example/extension/extension.go +++ b/example/extension/extension.go @@ -11,7 +11,7 @@ func main() { sql.Register("sqlite3_with_extensions", &sqlite3.SQLiteDriver{ Extensions: []string{ - "sqlite3_mod_regexp.dll", + "sqlite3_mod_regexp", }, }) diff --git a/example/extension/sqlite3_mod_regexp.c.example b/example/extension/sqlite3_mod_regexp.c similarity index 84% rename from example/extension/sqlite3_mod_regexp.c.example rename to example/extension/sqlite3_mod_regexp.c index 364c146..277764d 100644 --- a/example/extension/sqlite3_mod_regexp.c.example +++ b/example/extension/sqlite3_mod_regexp.c @@ -1,4 +1,4 @@ -#include +#include #include #include #include @@ -21,7 +21,11 @@ static void regexp_func(sqlite3_context *context, int argc, sqlite3_value **argv sqlite3_result_int(context, 1); } } -__declspec(dllexport) int sqlite3_extension_init(sqlite3 *db, char **errmsg, const sqlite3_api_routines *api) { + +#ifdef _WIN32 +__declspec(dllexport) +#endif +int sqlite3_extension_init(sqlite3 *db, char **errmsg, const sqlite3_api_routines *api) { SQLITE_EXTENSION_INIT2(api); return sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8, (void*)db, regexp_func, NULL, NULL); } diff --git a/sqlite3_windows.c b/sqlite3.c similarity index 100% rename from sqlite3_windows.c rename to sqlite3.c diff --git a/sqlite3_other.go b/sqlite3_other.go index 96fb194..52fea18 100644 --- a/sqlite3_other.go +++ b/sqlite3_other.go @@ -3,6 +3,6 @@ package sqlite3 /* -#cgo pkg-config: sqlite3 +#cgo LDFLAGS: -v -ldl */ import "C"