Use sqlite3.c in all platforms

This commit is contained in:
mattn 2013-08-28 14:46:33 +09:00
parent a3e3a8e981
commit 691a8a9de3
4 changed files with 8 additions and 4 deletions

View File

@ -11,7 +11,7 @@ func main() {
sql.Register("sqlite3_with_extensions", sql.Register("sqlite3_with_extensions",
&sqlite3.SQLiteDriver{ &sqlite3.SQLiteDriver{
Extensions: []string{ Extensions: []string{
"sqlite3_mod_regexp.dll", "sqlite3_mod_regexp",
}, },
}) })

View File

@ -1,4 +1,4 @@
#include <regex.h> #include <pcre.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <sqlite3ext.h> #include <sqlite3ext.h>
@ -21,7 +21,11 @@ static void regexp_func(sqlite3_context *context, int argc, sqlite3_value **argv
sqlite3_result_int(context, 1); 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); SQLITE_EXTENSION_INIT2(api);
return sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8, (void*)db, regexp_func, NULL, NULL); return sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8, (void*)db, regexp_func, NULL, NULL);
} }

View File

@ -3,6 +3,6 @@
package sqlite3 package sqlite3
/* /*
#cgo pkg-config: sqlite3 #cgo LDFLAGS: -v -ldl
*/ */
import "C" import "C"