Compiling the latest SQLite 3.8.4.3 for a DLL

Source: Internet
Author: User
Tags sqlite

SQLite is a small database. Especially suitable for use by client applications, its many advantages are not much to say. Interested in going to search.

Let's say use it.

We're going to use. You need to call it. Now, step by step.

The first step: on the SQLite website http://www.sqlite.org/download Its source code, it has two formats, one is a lot of files are put together, I call the integration code package, there is a lot of. C and. h files, are separate. I call it loose code package. Loose code package on the requirements of the compilation is relatively high, I do not have time to study its source code, and then become lazy, the use of integrated code package it. For example, with:

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvy2nwd19jbg==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/southeast ">

Download the code labeled on the diagram

Step Two: Prepare for compilation. After downloading it is a zip, untie. There are shell.c, sqlite3.c, sqlite3.h and sqlite3ext.h so many documents, among them SHELL.C we do not need, the others are to use

Step three: Start compiling, take VS2010 as an example, open VS2010. Create a Win32 DLL for empty project, and then add the three files sqlite3.c, sqlite3.h, and sqlite3ext.h to project to compile a DLL. Now it can be compiled, the problem is not exported after compiling the function, is not available, so need a def file (symbol definition file), this file is supposed to be able to join us, but you assume that you do not read the source code is not added, we simply. Use the official provided, this to be downloaded separately, of course, or just download location, find SQLite official for us to provide a good DLL download link. To download, for example, by:


Unpack this zip after downloading it. There is a def file in it, copy it to the project folder. And then added in the VS2010, now has the export function, but the compilation does not pass, we need to define two macros, they are:

Sqlite_enable_column_metadata

Sqlite_enable_rtree

Add the two macros to project, for example by:


Now compile, you can pass the

Problem one: When you compile the debug version number and release version number, the two macros should be added separately, otherwise it will not work.

Issue two: Compile release version number when you remember to set to static compilation, or in the absence of the VC library of the machine can not normally call this DLL.

Fourth step: Optimize processing and invocation

Now that you have a SQLite DLL, you can add a version resource for personalization, or other requirements. Then write some personalized information. So far, your SQLite DLL has been compiled. I am under the VS2010, compiled only 601KB. It's a lot smaller than the official 630KB (the smaller the DLL is, the better it is), and even you can give it a digital signature to show the copyright (it's not officially restricted to you).

The fifth step: Results show:


The final question: on the internet to see a lot of people want to solve this DLL interface char and wchar_t problem, I also checked some information, looked under, the official out of these interfaces looking at is char. In fact, it is utf-8, that is, what characters can be processed, but this is for foreign English Department of the country, the domestic user before the string is written to the database, to convert. After you read it, convert it again. Otherwise it is garbled (seemingly like parsing xml AH).

Compiling the latest SQLite 3.8.4.3 as a DLL

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.