[Qt-interest] SQLite: no functions are exported
Robert Hairgrove
evorgriahr at hispeed.ch
Sat Feb 26 11:39:04 CET 2011
On Fri, 2011-02-25 at 18:36 +0100, Thiago Macieira wrote:
> On Friday, 25 de February de 2011 17:37:42 Robert Hairgrove wrote:
> > I'm a little wary about linking directly to the SQLite library ... how
> > would I do this? It isn't safe to have both the plugin AND the sqlite3.c
> > source in my application because then I have two instances of the
> > library with all of the potential problems in memory allocation, etc.
>
> $ ldd $QTDIR/plugins/sqldrivers/libqsqlite.so
> linux-gate.so.1 => (0xffffe000)
> libsqlite3.so.0 => /usr/lib/libsqlite3.so.0 (0xb7769000)
> [others]
>
> Don't include sqlite3.c in your program. Link to the same sqlite3 library that
> the plugin links to.
Success!
After installing the development SQLite3 package from the Ubuntu
repository and recompiling Qt with the "-system-sqlite" configuration
option, I was able to link to the system's SQLite -- as per your
instructions :) -- and everything works now. It isn't the latest version
of SQLite, but 3.6.22 is good enough for now.
Both the Qt SQLite plugin and the system SQLite appear to be using the
same memory allocations, etc. -- at least I was able to verify that the
VFS member of the sqlite3 handle returned from QSqlDriver::handle() is
the same as the default VFS pointer returned from the function
"sqlite3_vfs_find(0)", which is no big surprise here but assures me that
there most likely won't be any difficult to debug errors in memory
allocations from now on.
On a side note, this also works without configuring Qt with the
"-no-reduce-exports" option, too.
Now I have to figure out how to achieve this setup on Windows and Mac.
Thank you very much, Thiago, for your help!
More information about the Qt-interest-old
mailing list