[SQLite] Building own sqlite3.dll?

Just starting out? Need help? Post your questions and find answers here.
User avatar
skywalk
Addict
Addict
Posts: 3972
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

[SQLite] Building own sqlite3.dll?

Post by skywalk »

Now that PB v571b1 supports:
#SQLITE_DLL_FNPATH$ = "C:\mysqlitepath\sqlite3.dll"
UseSQLiteDatabase(#SQLITE_DLL_FNPATH$)
I wanted to compile a light sqlite3.dll.
Below you can see many more features compiled into the precompiled binary than the Static PB lib.
For some app's I don't require any full text search. Speed of insertion/retrieval is the goal.

Here is a comparison of the PB Static lib vs the latest downloaded from SQLite's Windows x64.

Does anyone have a light make file for MS VS on Windows?
The one on the SQLite site is ~1000 lines long!

Code: Select all

STATIC PB lib:
SQLite Version    = 3.27.0
SQLite Lib        = 2019-02-07 17:02:52 97744701c3bd414e6c9d7182639d8c2ce7cf124c4fce625071ae65658ac6alt2
SQLite ThreadSafe = 1
SQLite Options:
COMPILER=msvc-1800
ENABLE_FTS3_PARENTHESIS
ENABLE_FTS4
ENABLE_UPDATE_DELETE_LIMIT
THREADSAFE=1

Precompiled sqlite3.dll:
SQLite Version    = 3.28.0
SQLite Lib        = 2019-04-16 19:49:53 884b4b7e502b4e991677b53971277adfaf0a04a284f8e483e2553d0f83156b50
SQLite ThreadSafe = 1
SQLite Options:
COMPILER=msvc-1500
ENABLE_COLUMN_METADATA
ENABLE_DBSTAT_VTAB
ENABLE_FTS3
ENABLE_FTS4
ENABLE_FTS5
ENABLE_GEOPOLY
ENABLE_JSON1
ENABLE_RTREE
ENABLE_STMTVTAB
MAX_TRIGGER_DEPTH=100
TEMP_STORE=1
THREADSAFE=1
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
skywalk
Addict
Addict
Posts: 3972
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: [SQLite] Building own sqlite3.dll?

Post by skywalk »

Given the makefile.msc is over 1000 lines, I opted to compile directly with the few switches I require.
I did try disabling unused switches in the make file, but the compiled dll was still 2MB.
This compiler sequence produces a 1MB dll.

Code: Select all

; COMPILE SOURCE AS DLL:
;   Use MS Visual Studio Command Prompt with the appropriate target: x86 or x64.
;   Ex. shortcut: x64 Native Tools Command Prompt for VS 2017
;   %comspec% /k "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat
;
;   Then create and execute a bat file with the following: (enable/disable desired options)
;   cl sqlite3.c -DSQLITE_THREADSAFE -DSQLITE_API=__declspec(dllexport) -link -dll -out:sqlite3.dll

SQLite Version    = 3.28.0
SQLite Lib        = 2019-04-16 19:49:53 884b4b7e502b4e991677b53971277adfaf0a04a284f8e483e2553d0f83156b50
SQLite ThreadSafe = 1
SQLite Options:
COMPILER=msvc-1915
THREADSAFE=1
This does not populate the version fields within the dll. Yes, the makefile has batch code to run rc.exe but I could not find that on my machine.
So, I compiled sqlite3.rc to sqlite3.res using resourcehacker.exe.
Then I append the compiled resource to the -link list.

Code: Select all

C:\dev-try\db\sqlite-amalgamation-3280000>
cl sqlite3.c -DSQLITE_THREADSAFE -DSQLITE_API=__declspec(dllexport) -link -dll -out:sqlite3.dll sqlite3.res
Now I have a working, minimum options 64-bit sqlite3.dll with version info intact!
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
mchael
User
User
Posts: 15
Joined: Mon Oct 14, 2019 7:31 am

Re: [SQLite] Building own sqlite3.dll?

Post by mchael »

Try codeblocks: https://forums.wxwidgets.org/viewtopic.php?t=37628 or maybe this: http://forums.codeblocks.org/index.php?topic=455.0

VS Studio turns the computer into a heater. Codeblocks is much faster and cooler :-)
Post Reply