Documentation Source Text

Artifact Content
Login

Artifact e789620d0a93130cf48d9ffa7c272d56a4661d0b:


<title>SQLite Is Self-Contained</title>

<h2>SQLite Is Self-Contained</h2>

<p>
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.
</p>

<p>
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:
</p>

<ul>
<li> memset()
<li> memcpy()
<li> memcmp()
<li> strcmp()
<li> malloc(), free(), and realloc()
</ul>

<p>
SQLite can be configured at start-time to 
[memsys5 | 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.
</p>

<p>
Communications between SQLite and the operating system and disk are
mediated through an interchangeable [VFS] layer.
VFS modules for Unix and Windows
are provided in the source tree.  It is a simple matter to devise an
alternative VFS for embedded devices.
</p>

<p>
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.
</p>

<p>
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.
</p>