Build a windows dll for sqlite3

For the root cause is the sqlite3.dll download from official is not the release version, so you need to rebuild it by youself.

5. Building A Windows DLL

To build a DLL of SQLite for use in Windows, first acquire the appropriate amalgamated source code files, sqlite3.c and sqlite3.h. These can either be downloaded from the SQLite website or custom generated from sources as shown above.

With source code files in the working directory, a DLL can be generated using MSVC with the following command:

cl sqlite3.c -link -dll -out:sqlite3.dll

The above command should be run from the MSVC Native Tools Command Prompt. If you have MSVC installed on your machine, you probably have multiple versions of this Command Prompt, for native builds for x86 and x64, and possibly also for cross-compiling to ARM. Use the appropriate Command Prompt depending on the desired DLL.

If using the MinGW compiler, the command-line is this:

gcc -shared sqlite3.c -o sqlite3.dll

Note that MinGW generates 32-bit DLLs only. There is a separate MinGW64 project that can be used to generate 64-bit DLLs. Presumably the command-line syntax is similar. Also note that recent versions of MSVC generate DLLs that will not work on WinXP and earlier versions of Windows. So for maximum compatibility of your generated DLL, MinGW is recommended. A good rule-of-thumb is to generate 32-bit DLLs using MinGW and 64-bit DLLs using MSVC.

In most cases, you will want to supplement the basic commands above with compile-time options appropriate for your application. Commonly used compile-time options include:

  • -Os - Optimize for size. Make the DLL as small as possible.

  • -O2 - Optimize for speed. This will make the DLL larger by unrolling loops and inlining functions.

  • -DSQLITE_ENABLE_FTS4 - Include the full-text search engine code in SQLite.

  • -DSQLITE_ENABLE_RTREE - Include the R-Tree extension.

  • -DSQLITE_ENABLE_COLUMN_METADATA - This enables some extra APIs that are required by some common systems, including Ruby-on-Rails.

Other issue please refer to my blog: https://blog.csdn.net/MissLong/article/details/82752512

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值