How to Build for Windows x32 and Windows x64 =============================================== Taken from: http://www.sqlite.org/howtocompile.html and: http://www.sqlite.org/threadsafe.html How to Build for Windows x64 ------------------------------ (environment as per postgres) rc /d _WIN64 version32.rc cl -O2 /GS /Wp64 /Zi /MD /Fdsqlite3x64.pdb -DSQLITE_THREADSAFE=2 sqlite3.c bufferoverflowU.lib -link -machine:AMD64 -def:sqlite3.def -dll version32.res -out:sqlite3x64.dll cl -O2 /GS /Wp64 /Zi /MD /Fdsqlite3x64exe.pdb shell.c sqlite3.c bufferoverflowU.lib version32.res -Fesqlite3x64.exe -link -machine:AMD64 copy sqlite3x64.exe D:\cvsdeps\sqlite\bin\x64 copy sqlite3x64exe.pdb D:\cvsdeps\sqlite\bin\x64 copy sqlite3x64.dll D:\cvsdeps\sqlite\bin\x64 copy sqlite3x64.pdb D:\cvsdeps\sqlite\bin\x64 copy sqlite3x64.lib D:\cvsdeps\sqlite\lib\x64 How to Build for Windows x32 ------------------------------ call "C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\SetEnv.Cmd" /2000 /RETAIL set PATH=%PATH%;D:\cvsdeps\x32\libxml2\bin set PROGFILES="Program Files" IF %PROCESSOR_ARCHITECTURE%~==AMD64~ set PROGFILES="Program Files (x86)" IF "%ProgramFiles(x86)%~"=="C:\Program Files (x86)~" set PROGFILES="Program Files (x86)" set PATH=C:\wix;D:\cvsbin;D:\cvsbin\sysfiles;%PATH%;C:\"%PROGFILES%"\winzip;C:\"%PROGFILES%"\PuTTY;C:\"%PROGFILES%"\"HTML Help Workshop";C:\cygwin\bin cd /d D:\cvsbin\release builder\sqlite-3.3.17 del *.res del *.obj del *.lib del *.exe del *.pdb del *.dll del *.ilk del *.exp rc /d _WIN32 version32.rc cl -O2 -Zi -MD -Fdsqlite3.pdb -DSQLITE_THREADSAFE=2 sqlite3.c -link -def:sqlite3.def -dll version32.res -out:sqlite3.dll cl -O2 -Zi -MD -Fdsqlite3exe.pdb -DSQLITE_THREADSAFE=2 shell.c sqlite3.c version32.res -Fesqlite3.exe copy sqlite3.exe D:\cvsdeps\sqlite\bin copy sqlite3.dll D:\cvsdeps\sqlite\bin copy sqlite3.lib D:\cvsdeps\sqlite\lib Notes from web site: ------------------------------ 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.