SQLite Is Self-Contained

Small. Fast. Reliable.
Choose any three.

About Sitemap Documentation Download License News Support |

## SQLite Is Self-Contained

SQLite is largely self-contained. It requires very minimal support from external libraries or from the operating system. This makes it well suited for use in embedded devices that lack the support infrastructure of a desktop computer. This also makes SQLite appropriate for use within applications that need to run without modification on a wide variety of computers of varying configurations.

SQLite is written in ANSI-C and should be easily compiled by any standard C compiler. It makes minimal use of the standard C library. The only required C library functions called are:

- memset()
- memcpy()
- memcmp()
- strcmp()
- malloc(), free(), and realloc()

SQLite can be configured at start-time to use a static buffer in place of calling malloc() for the memory it needs. The date and time SQL functions provided by SQLite require some additional C library support, but those functions can be also be omitted from the build using compile-time options.

Communications between SQLite and the operating system and disk are mediated through an interchangeable VFS layer. VFS modules for Unix (Linux and Mac OS X), OS/2, and Windows (Win32 and WinCE) are provided in the source tree. It is a simple matter to devise an alternative VFS for embedded devices.

For safe operation in multi-threaded environments, SQLite requires the use of mutexes. Appropriate mutex libraries are linked automatically for Win32 and POSIX platforms. For other systems, mutex primitives can be added at start-time using the sqlite3_config(SQLITE_CONFIG_MUTEX,...) interface. Mutexes are only required if SQLite is used by more than one thread at a time.

The SQLite source code is available as an "amalgamation" - a single large C source code file. Projects that want to include SQLite can do so simply by dropping this one source file (named "sqlite3.c") and its corresponding header ("sqlite3.h") into their source tree and compiling it together with the rest of the code. SQLite does not link against any external libraries (other than the C library, as described above) and does not require any special build support.