On Monday, 21 August, 2017 11:44, curmudgeon wrote:

>Thanks Keith. I followed your instructions but I'm now getting the
>following compiler errors

>[bcc32 Error] carray.c(412): E2342 Type mismatch in parameter 'xInit'
>(wanted 'void (*)()', got 'void *')
>// on the 'nErr +=
>sqlite3_auto_extension((void*)sqlite3_carray_init); line'

This is because you are compiling with a C++ compiler and C++ is picky about 
types (or your compiler is too picky about types when processing C files).  In 
C, a void* can be used anywhere for anything -- it is a completely generic 
pointer -- and you are supposed to know what you are doing if you use one 
(since there is actually no such thing as a "void" that can be pointed at).

You need to change the cast to the expected type:

nErr += sqlite3_auto_extension((void(*)())sqlite3_carray_init);


>[bcc32 Error] carray.c(430): E2040 Declaration terminated incorrectly
>// on the '-DSQLITE_EXTRA_INIT=core_init' line

This is because these are compiler directives and do not go in the source code. 
 They are defines that you pass to the compiler as command line arguments.  IE, 
to have the equivalent of "#define SQLITE_EXTRA_INIT core_init" in effect 
before the sqlite3.c is compiled.  If your compiler has a hooey-gooey, then 
there is some place in it for you to create defines.  You need to define 
SQLITE_EXTRA_INIT=core_init.

>I assume carray.c wasn't being compiled at all the other way and
>that's why there were no errors reported. I tried wrapping the 
>carray.c code in extern "C" {...carray.c code...} in case it was 
>something to do with that but then I got a 'Declaration terminated 
>incorrectly' error on the first line which contains extern "C" {

Yeah.  Compiling C code in C++ mode is a dogs breakfast.  Actually, if 
sqlite3.c is being processed as C++ code I am surprised you are not getting 
billions of errors because many of the rules for incomplete types are different 
in C++ vs C.  When compiling C code the compiler you are using must be  
half-way C compliant and half-way C++ compliant ...





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

Reply via email to