Greetings,

> I declare a struct and pass it as the 4th argument of sqlite3_exec(),
> and define the 1st argument of callback function a pointer to this kind
> of struct. while compiling, GCC give a warning like this:
>       ae.c: In function ‘main’:
>       ae.c:56: warning: passing argument 3 of ‘sqlite3_exec’ from
> incompatible pointer type

The problem here is the type of your callback() function. By declaring 
the first argument to it as MyStruct*, rather than void* as in the 
function pointer type of the 3rd argument to sqlite3_exec(), you're 
creating an incompatible function pointer type.

> however, the program runs well. What may causing the warning? what
> should i do to get rid of this warning.

Simply change the type of the first argument to your callback function 
to void* and the problem should go away. Of course you'll then have to 
cast back to MyStruct* inside callback() to actually use the value.

Hope this helps,
-- Markus Thiele
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to