将SQLite与DMD静态链接(Windows x86) [英] Statically linking SQLite with DMD (Windows x86)

查看:122
本文介绍了将SQLite与DMD静态链接(Windows x86)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试与sqlite3静态链接,但未成功.我正在使用'etc.c.sqlite3'标头和sqlite3合并.为了创建.lib文件,我已经尝试了VC ++和MinGW-gcc,它们都成功地编译了源文件-但是它们都生成COFF对象格式(DMD使用的optlink与OMF一起使用).在阅读了有关"digitalmars.D"的大量文章之后,我尝试了几种不同的解决方案.

objconv:

  • 试图转换使用GCC创建的lib文件,导致未定义的符号(例如__divdi3和__muldi3)无法解决.

  • 也尝试过将sqlite3.o文件转换为* .obj,然后使用digitalmars'lib.exe'-也不成功

  • 在VC ++生成的库上尝试objconv失败,原因是:"SQLite.lib是导入库"

implib:

  • 如果我从sqlite.org下载预编译的DLL并使用implib,它将生成一个lib文件,但是名称mangling似乎不匹配,因为即使我与静态库链接,我仍然会收到相同的sqlite错误(例如,未定义的符号_sqlite3_open_sqlite3_errmsg_sqlite3_close ...

coffimplib:

  • 如果我在VC ++创建的库文件上使用coffimplib,该程序将生成一个几乎为空的文件(〜2KB),该文件仅包含垃圾(即完全没有符号,并且大多只是空"值). >

  • 如果我对GCC创建的库执行相同的操作,则coffimplib会抱怨不是导入库",并且不会生成任何转换后的库文件.

如果我使用DMC编译sqlite3合并,则编译失败并提示错误.所以在这里,我无所适从,没有人有任何想法或提示可以解决此问题吗?

注意:我不想使用DLL,而是与sqlite静态链接(出于对可执行文件大小的考虑).

解决方案

尝试将implib/system开关一起使用.

I've tried to statically link with sqlite3 without success. I'm using the 'etc.c.sqlite3' header, and the sqlite3 amalgamation. To create the .lib file I've tried both VC++ and MinGW-gcc, both of these compile the source file successfully - but they both generate COFF object format (optlink, which DMD uses, works with OMF). After reading tons of posts on 'digitalmars.D', I've tried several different solutions.

objconv:

  • tried to convert lib file created with GCC, resulted in undefined symbols such as __divdi3 and __muldi3, wasn't able to solve this.

  • Also tried this to convert the sqlite3.o file to *.obj, and then use digitalmars 'lib.exe' - unsuccessful as well

  • Attempting objconv on a VC++ generated lib fails because: "SQLite.lib is an import library"

implib:

  • If I download the precompiled DLL from sqlite.org and use implib, it generates a lib file, but the name mangling does not seem to match, because even though I link with the static library, I still receive the same sqlite errors (e.g undefined symbol _sqlite3_open, _sqlite3_errmsg, _sqlite3_close...

coffimplib:

  • If I use coffimplib on the VC++ created library file, the program generates a nearly empty file (~2KB) which only contains garbage (i.e no symbols at all and mostly just 'null' values).

  • If I do the same with the GCC created library, coffimplib complains about "not an import library" and no converted library file is generated.

If I use DMC to compile the sqlite3 amalgamation, the compilation fails complaining about tons of errors. So here I am, stuck in nowhere, does anyone have any ideas or tips what might solve this?

NOTE: I do not want to use a DLL, but statically link with sqlite (for executable size concerns).

解决方案

Try using implib with /system switch.

这篇关于将SQLite与DMD静态链接(Windows x86)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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