SQLite 库可以嵌入(链接)到 Delphi 可执行文件吗?
我想知道我们是否能够将 SQlite 库嵌入到 Delphi 可执行文件中,并且我们可以将应用程序部署为单个 .exe 文件,而无需任何 SQlite dll 文件。
嵌入不是将 sqlite dll 文件保留到资源中,而是链接到 Delphi 可执行文件。
I am wondering if we able to embed SQlite library into Delphi executable file and we may deploy our application as single .exe file without any SQlite dll file.
The embed is not keep the sqlite dll file into resource but link to Delphi executable file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我还没有尝试过这个组件,但我计划将来尝试一下
Delphi灵感-DISQLite3
还有
Synopse OpenSource SQLite3 Framework
也提供免费软件版本
I have not tried this component out, but I plan to in the future
Delphi Inspiration - DISQLite3
There is also
Synopse OpenSource SQLite3 Framework
A Freeware version is available too
我们使用 Borland 的免费命令行工具 C 编译器编译了 SQLite3,并在 Delphi 中使用 {$LINK 'OBJS\sqlite3.obj'} 链接了生成的 OBJ 文件,并为我们需要的函数编写了 pascal 包装器。
链接时解决一些标准 C 库函数存在问题,但我们在 Delphi 中重新实现了它们。
We have compiled SQLite3 with Borland's free command line tools C compiler and the resulting OBJ file we linked in Delphi with {$LINK 'OBJS\sqlite3.obj'}, and written the pascal wrappers for the functions we needed.
There was a problem resolving some standard C library functions when linking but we re-implemented them in Delphi.
我遇到了同样的问题,这是我想出的解决方案。也许它可以帮助你。只需包含 sqlite3,然后您就可以直接访问 dll 函数。我使用了已经概述的相同方法:
http://simvector.com/download/delphi_sqlite3.zip
DLL 只是以源代码形式编码DLLLoader 单元在运行时加载它。最终结果是您的发行版中没有额外的 DLL,但代价是所有 DLL 都被一次性加载到内存中,而不是通过操作系统按需加载部分内容。
我们需要它正常工作,但发行版中没有额外的 dll。所以适合我们的需求。
I had the same problem and this is the solution I came up with. Maybe it can help you. Just include sqlite3 and you then have direct access to the dll functions. I used the same methods that have already be outlined:
http://simvector.com/download/delphi_sqlite3.zip
The DLL is just encoded in source form and the DLLLoader unit loads it at runtime. The end result is no extra DLL in your distro at the expense of it all being loaded into memory at once vs parts loaded on demand via the OS.
We needed it to work as normal, yet no extra dll in distro. So works for our needs.
Anydac SQLite 驱动程序具有静态链接的 SQLite 引擎。不过,它是商业图书馆。他们有一篇文章 Anydac 和 sqlite。
Anydac SQLite driver has statically linked SQLite engine. It is commercial library, although. They has an article about anydac and sqlite.
Delphi 可以链接 .obj 文件,因此如果您有可用的文件(或编译它们的源代码),您可以将它们链接到可执行文件中。但您不能使用 SQLLite dll 来实现这一点。
IIRC DISQLite 3 正是这样做的,检查一下。
Delphi can link .obj files, thereby if you have them available (or source code to compile them), you can link them into an executable. But you can't to that with the SQLLite dll.
IIRC DISQLite 3 does exactly that, check it.
您可以下载 SQLite 开源并将其编译到任何可以编译普通 C 代码的环境中。这并不是特别难。
You can download the SQLite open source and compile it into any environment that can compile vanilla C code. It's not especially hard.