>   The extension-functions file doesn't actually implement any of the
>   math functinos, it simply acts as a glue layer between SQLite and the
>   system math library.  In this case, it looks like the run-time linker
>   that loads the extension can't resolve the call for log() from the
>   extension into the math library, resulting in an unresolved link.
>
>   On many systems the math library is part of the standard set of libs
>   that are imported by the linker for all applications.  There are a
>   few systems, however, where the math library is not part of the
>   standard lib set.  On those systems, you need to explicitly tell the
>   linker you want the math library made avaliable.  You can do that
>   by compiling the lib with -lm to import the math library.  The math
>   lib won't be pulled into the .so, but it will be noted that if the
>   run-time linker pulls in the extension, it will also need to pull in
>   the math library before it attepts to resolve all the symbols.
>
>   At least, in theory.

Thanks for coherent explanation. I am compiling library with switch -lm and 
now it's work.

$ gcc -fPIC -lm -shared extension-functions.c -o libsqlitefunctions.so
$ sqlite3 :memory:
sqlite> SELECT load_extension('./libsqlitefunctions.so');

sqlite> select sqrt(16);
4.0
sqlite>

>
>   What OS are you trying this on?

Linux Debian Etch (sqlite pakage backported from Debian Lenny).


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to