Salutations, I'm programing in C, new to SQLite, in Windows, with the Pelles C Compiler for Windows. When I create a Console project and put, for example, the following commands (an SQLite connection with callback function):
static int callback(void *NotUsed, int argc, char **argv, char **azColName){ // Show "column 1 -> column 2" in a MessageBox char output[256]; sprintf(output, "%s -> %s", argv[0], argv[1]); MessageBox(0, output, "", 0); return 0; } sqlite3 *db; sqlite3_open("dict.db", &db); char *zErrMsg; int rc; rc = sqlite3_exec(db, "select * from a where a = 'key1'", callback, 0, &zErrMsg); rc = sqlite3_exec(db, "select * from a where a = 'key2'", callback, 0, &zErrMsg); It works well. BUT, when I try to put this code in a Win32 application, like inside a WinMain procedure, for example, a strange behavior happens: everytime sqlite3_exec finds exactly more than 3 records in the database, it gives an "Access Violation" error. Pelles C's debugger gives "Exception: Access Violation", apparently in NTDLL.DLL. It happens with any database of any size, as long as SELECT returns more than 3 results. We tested it in 2 computers Windows XP Pro (one of them 2.4 GHz and 1GB RAM, and the other 1.1GHz and 384 MB RAM), and, in both of them, the error happens every time SELECT finds more than 3 records (so, I could never have noticed it if I had tested it only with SELECTs that return 3 or less results); we tried to increase Stack Reserve size, but no difference. Important to notice is the fact that it works fine in a Console application, and also in sqlite3.exe it works fine. Any ideas? Thank you in advance.