Hi,

I'm using the Amalgamation file currently available from
<http://www.sqlite.org/download.html> (named
sqlite-amalgamation-3071300.zip).
When I compile it in Visual Studio 2010 with SQLITE_ZERO_MALLOC defined,
I get
a double-definition of the default memory allocator functions:

1>sqlite3.c(15385): error C2084: function 'void *sqlite3MemMalloc(int)'
already has a body
1>          sqlite3.c(15245) : see previous definition of
'sqlite3MemMalloc'
1>sqlite3.c(15417): error C2084: function 'void sqlite3MemFree(void *)'
already has a body
1>          sqlite3.c(15246) : see previous definition of
'sqlite3MemFree'
1>sqlite3.c(15432): error C2084: function 'int sqlite3MemSize(void *)'
already has a body
1>          sqlite3.c(15248) : see previous definition of
'sqlite3MemSize'
1>sqlite3.c(15454): error C2084: function 'void *sqlite3MemRealloc(void
*,int)' already has a body
1>          sqlite3.c(15247) : see previous definition of
'sqlite3MemRealloc'
1>sqlite3.c(15486): error C2084: function 'int sqlite3MemRoundup(int)'
already has a body
1>          sqlite3.c(15249) : see previous definition of
'sqlite3MemRoundup'
1>sqlite3.c(15493): error C2084: function 'int sqlite3MemInit(void *)'
already has a body
1>          sqlite3.c(15250) : see previous definition of
'sqlite3MemInit'
1>sqlite3.c(15529): error C2084: function 'void sqlite3MemShutdown(void
*)' already has a body
1>          sqlite3.c(15251) : see previous definition of
'sqlite3MemShutdown'
1>sqlite3.c(15540): error C2084: function 'void
sqlite3MemSetDefault(void)' already has a body
1>          sqlite3.c(11581) : see previous definition of
'sqlite3MemSetDefault'

The following patch will remedy this:

--- a/src/sqlite3/sqlite3.c
+++ b/src/sqlite3/sqlite3.c
@@ -402,11 +402,11 @@
 ** If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as
 ** the default.
 */
-#if
defined(SQLITE_SYSTEM_MALLOC)+defined(SQLITE_WIN32_MALLOC)+defined(SQLITE_MEMDEBUG)>1
+#if
defined(SQLITE_SYSTEM_MALLOC)+defined(SQLITE_WIN32_MALLOC)+defined(SQLITE_MEMDEBUG)+defined(SQLITE_ZERO_MALLOC)>1
 # error "At most one of the following compile-time configuration
 options\
- is allows: SQLITE_SYSTEM_MALLOC, SQLITE_WIN32_MALLOC, SQLITE_MEMDEBUG"
+ is allowed: SQLITE_SYSTEM_MALLOC, SQLITE_WIN32_MALLOC,
SQLITE_MEMDEBUG, SQLITE_ZERO_MALLOC"
 #endif
-#if
defined(SQLITE_SYSTEM_MALLOC)+defined(SQLITE_WIN32_MALLOC)+defined(SQLITE_MEMDEBUG)==0
+#if
defined(SQLITE_SYSTEM_MALLOC)+defined(SQLITE_WIN32_MALLOC)+defined(SQLITE_MEMDEBUG)+defined(SQLITE_ZERO_MALLOC)==0
 # define SQLITE_SYSTEM_MALLOC 1
 #endif

Thanks!

-- 
Duncan Smith
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to