On Tue, Jun 7, 2011 at 12:52 PM, Jay A. Kreibich <j...@kreibi.ch> wrote:
> On Tue, Jun 07, 2011 at 07:47:25PM +0400, Max Vlasov scratched on the wall: > > Hi, > > > > I'm trying to use sqlite with linux (Ubuntu, Pascal, Lazarus). I'm still > not > > very familiar with linux development so I might miss something essential. > > > > Two scenarios work ok > > - statically linked latest version compiled (3.7.6.3), no options or > defines > > changed > > - Dynamically loaded (dlopen) sqlite used from the installed package > > libsqlite3 (libsqlite3.so) > > That's not how dynamic libraries work (not normally, anyways). > Generally you simply tell the compiler/linker to link in the library > at build time, and allow the usage of dynamic libs. The dynamic > link is then done on application start-up by the OS. In Windows > terms, it is like using an .DLL by linking in the associated .lib > file. Moving from a static library to a dynamic library requires no > code changes. > There is a way to do a _good_ shared library. I suggest reading the excellent paper: http://www.akkadia.org/drepper/dsohowto.pdf As for the OP question, do gcc -shared -Wl,-init=sqlite3_initialize -o libsqlite.so sqlite3.o and then link your application with gcc -L. -lsqlite -o test test.c This assumes that libsqlite.so is in your current path: . (thus the -L.) -- Martin _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users