Re: [sqlite] Problem using loadable extension mechanism.
Hi, I build **without** -DSQLITE_OMIT_LOAD_EXTENSION I do ldd on sqlite3 and I get libdl.so.2 => /lib/libdl.so.2 (0x00402000) but I cannot load my Extension.so Do Extension.c has to include sqlite3.h ? Presently I am only including sqlite3ext.h. If I have used --enable-thread at sqlite makefile configure time...can this cause an impact? jima 2006/9/15, Christian Werner <[EMAIL PROTECTED]>: jima wrote: > > Thanks for the advice but it would not work either. I just tried with the > flags you mentioned at compile time and full path when loading. > > Do you know if I have to enclose that full path in quotes or something at > load time? like... > > ..load '/path/Extension.so' > > ? > > I tried several combinations of quotes but no luck here. > > I will recheck all what I have been doing just to make sure there is not an > easy explanation for this... Did you rebuild your sqlite3 shell without -DSQLITE_OMIT_LOAD_EXTENSION and does an ldd on sqlite3 indicate that has libdl.so linked, e.g. $ ldd ./sqlite3 ... libdl.so.2 => /lib/libdl.so.2 (0x00402000) ... Then that sqlite3 shell command should do what you want: $ ./sqlite3 ... sqlite> load './Extension.so' HTH, Christian - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Problem using loadable extension mechanism.
Better still, I have tried with full text search extension and I was able to load it. I will re-check my code. It is the most clear suspect now. jima 2006/9/15, jima <[EMAIL PROTECTED]>: I have them both...I read the wiki page before trying this myself. I will try with the exact code that it is contained at the page. Thanks for the hint. jima 2006/9/15, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > jima <[EMAIL PROTECTED]> wrote: > > > > unable to open shared library [Extension.so] > > > > Any clues of what is going on? > > > > Did you base your implementation of Extension.c off of the > example C code contained in the wiki? > >http://www.sqlite.org/cvstrac/wiki?p=LoadableExtensions > > The magic macros SQLITE_EXTENSION_INIT1 and SQLITE_EXTENSION_INIT2 > really are necessary for everything to work right. Did you, > prehaps, omit one or both? > > -- > D. Richard Hipp <[EMAIL PROTECTED]> > > > - > > To unsubscribe, send email to [EMAIL PROTECTED] > > - > >
Re: [sqlite] Problem using loadable extension mechanism.
I have them both...I read the wiki page before trying this myself. I will try with the exact code that it is contained at the page. Thanks for the hint. jima 2006/9/15, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: jima <[EMAIL PROTECTED]> wrote: > > unable to open shared library [Extension.so] > > Any clues of what is going on? > Did you base your implementation of Extension.c off of the example C code contained in the wiki? http://www.sqlite.org/cvstrac/wiki?p=LoadableExtensions The magic macros SQLITE_EXTENSION_INIT1 and SQLITE_EXTENSION_INIT2 really are necessary for everything to work right. Did you, prehaps, omit one or both? -- D. Richard Hipp <[EMAIL PROTECTED]> - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Problem using loadable extension mechanism.
Thanks for the advice but it would not work either. I just tried with the flags you mentioned at compile time and full path when loading. Do you know if I have to enclose that full path in quotes or something at load time? like... .load '/path/Extension.so' ? I tried several combinations of quotes but no luck here. I will recheck all what I have been doing just to make sure there is not an easy explanation for this... Thanks again, jima 2006/9/15, Christian Werner <[EMAIL PROTECTED]>: jima wrote: > ... > And then I go, no problems building. I have sqlite built with this > feature I guess. > > But the thing is that I cannot make it to work. I prepared a c file > following the template given in the wiki. I generated a .so using: > > gcc -I/path_to_sqlite-3.3.7/src -c -o Extension.o Extension.c Add the compiler switch -fPIC here. > And > > gcc -shared -o Extension.so Extension.o/path_to_libsqlite3.so/libsqlite3.so Omit libsqlite3.so here, there's no need for it in the extension. > ... > When I do in sqlite3 prompt: > > ..load Extension.so Use the full path to Extension.so or prefix it with ./ Hope that helps, Christian - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] Problem using loadable extension mechanism.
Hi all, I hope this is now the right place to tell this story after being redirected to this list by drh. I first submitted this as a ticket (sorry about that). I am building sqlite from sources in a debian sarge box. I am interested in Loadable Extensions. I had to introduce into the Makefile the following lines to enable the loadable extension mechanism: TCC += -DHAVE_DLOPEN and TLIBS += /usr/lib/libdl.so And then I go, no problems building. I have sqlite built with this feature I guess. But the thing is that I cannot make it to work. I prepared a c file following the template given in the wiki. I generated a .so using: gcc -I/path_to_sqlite-3.3.7/src -c -o Extension.o Extension.c And gcc -shared -o Extension.so Extension.o /path_to_libsqlite3.so/libsqlite3.so I linked with this warning: /usr/bin/ld: Warning: size of symbol 'sqlite3_api' changed from 4 to 460 in /path_to_libsqlite3.so/libsqlite3.so But it produced the .so that I wanted. When I do in sqlite3 prompt: .load Extension.so It goes: unable to open shared library [Extension.so] Any clues of what is going on? Perhaps a sample gcc invokation line for building the extension would also be a good thing in the docs. Thank you very much. jima - To unsubscribe, send email to [EMAIL PROTECTED] -