如何将扩展编译为sqlite? [英] How to compile an extension into sqlite?

查看:61
本文介绍了如何将扩展编译为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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆