Good morning. I just subscribed to the list. I've been using Sqlite for an year without problems, but recently I have to face up quite often with the error "library routine called out of sequence" and it seems I can't solve it definitely.
I'll explain better: I'm programming under Linux (I'm not very skilled in Linux) and using 2.8.5 library version (july 2003) after downloading 2.8.5.tar.gz file from your site. In practice I produced the library files libsqlite.a, libsqlite.la, libsqlite.lai, libsqlite.so, libsqlite.so.0, libsqlite.so.0.86 using the flag THREADSAFE = 1. My program contains 4 threads all accessing the same database Sqlite, a file called MwpCom.sql, composed by many tables. Every thread updates or makes sql inserts in his own tables, but, as I wrote, all the tables belong to same file MwpCom.sql. During my first tests I used to share between the 4 threads the pointer returned by sqlite_open() , to tell the truth I used many sqlite_open() so I shared many pointers, all pointing to the same file Sqlite. I always obtained the error "library routine called out of sequence" while trying to access any table. Later, reading some hints about Sqlite concurrency, I discovered that this way of using pointers was wrong, so I changed my code in order not to share the pointers anymore (every thread now has his own connections, alias his own sqlite_open()), and things improved immediately. But unfortunately sometimes one of the 4 threads, while attempting to access his tables, gives "library routine called out of sequence". I don't know what to do. If I restart my program for a while it runs ok, so I think the database isn't corrupted, but first or later, i get the error. Can you suggest me something? Should I try with the last release of libraries (2.8.15) ? I hope you can help me. Thank you in advance.

