如何将扩展编译为sqlite? [英] How to compile an extension into sqlite?
问题描述
我想将扩展编译为sqlite以便在运行时加载.
I would like to compile an extension into sqlite for loading at runtime.
我使用的文件是 https://www.sqlite.org/contrib <的扩展名-functions.c
我已经能够编译成可加载模块,但是我需要静态链接它以便在运行时加载(使用shell.c
在运行时创建接口)
I have been able to compile into a loadable module but I need to statically link it for loading at runtime (using shell.c
to create an interface at run time)
我已经阅读了有关链接的手册,但是老实说,这超出了我的理解范围!
I have read the manual on linking, but to be honest, it's a little bit beyond my scope of comprehension!
有人可以让我知道我需要做什么来编译吗?
Could someone let me know what I need to do to compile please?
推荐答案
问:如何将扩展编译为sqlite?"
Q: "How to compile an extension into sqlite?"
A:这取决于扩展名.要编译OP中引用的extension-functions.c
:
A: That depends on the extension. To compile extension-functions.c
referenced in the OP:
gcc -fPIC -shared extension-functions.c -o libsqlitefunctions.so -lm
(要删除编译警告,请参见此处)
(to remove the compilation warning see here)
用法:
$ sqlite3
sqlite3> select cos(radians(45));
0.707106781186548
sqlite> .exit
这篇关于如何将扩展编译为sqlite?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!