Skip to content

Commit 78124cb

Browse files
author
Christian Brauner
committed
actually link to <sqlite3.h> when -tags libsqlite3
Building with -tags libsqlite3 used the sqlite3.h from the system but the go compiler will compile all *.{c,h} files in the same direcory: "When the Go tool sees that one or more Go files use the special import "C", it will look for other non-Go files in the directory and compile them as part of the Go package. Any .c, .s, or .S files will be compiled with the C compiler." (https://golang.org/cmd/cgo/) So if users actually want to link against the system sqlite3 we should make sqlite3-binding.* a noop. Signed-off-by: Christian Brauner <[email protected]>
1 parent e5a3c16 commit 78124cb

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

sqlite3-binding.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
** language. The code for the "sqlite3" command-line shell is also in a
1818
** separate file. This file contains only code for the core SQLite library.
1919
*/
20+
#ifndef USE_LIBSQLITE3
2021
#define SQLITE_CORE 1
2122
#define SQLITE_AMALGAMATION 1
2223
#ifndef SQLITE_PRIVATE
@@ -197846,5 +197847,9 @@ static int sqlite3Fts5VocabInit(Fts5Global *pGlobal, sqlite3 *db){
197846197847

197847197848

197848197849
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS5) */
197850+
#else // USE_LIBSQLITE3
197851+
// If users really want to link against the system sqlite3 we
197852+
// need to make this file a noop.
197853+
#endif
197849197854

197850197855
/************** End of fts5.c ************************************************/

sqlite3-binding.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
** the version number) and changes its name to "sqlite3.h" as
3131
** part of the build process.
3232
*/
33+
#ifndef USE_LIBSQLITE3
3334
#ifndef SQLITE3_H
3435
#define SQLITE3_H
3536
#include <stdarg.h> /* Needed for the definition of va_list */
@@ -10338,5 +10339,9 @@ struct fts5_api {
1033810339
#endif
1033910340

1034010341
#endif /* _FTS5_H */
10342+
#else // USE_LIBSQLITE3
10343+
// If users really want to link against the system sqlite3 we
10344+
// need to make this file a noop.
10345+
#endif
1034110346

1034210347
/******** End of fts5.h *********/

0 commit comments

Comments
 (0)