I have compiled SQLIte3 database engine from sqlite3.c with BCC 55 using the following command:
bcc32.exe -jb -O2 -w- -K -c -6 -u- sqlite3.c
The proper sqlite3.obj file was generated. But once I try to link it in my Delphi application like this:
unit unt_SQLite3;
interface
uses
Windows;
implementation
{$LINK 'sqlite3.obj'}
end.
I get the following errors:
[DCC Error] E2065 Unsatisfied forward or external declaration: '__ftol'
[DCC Error] E2065 Unsatisfied forward or external declaration: '__lldiv'
[DCC Error] E2065 Unsatisfied forward or external declaration: '__llmod'
[DCC Error] E2065 Unsatisfied forward or external declaration: '_localtime'
[DCC Error] E2065 Unsatisfied forward or external declaration: '_strncmp'
[DCC Error] E2065 Unsatisfied forward or external declaration: '_memset'
[DCC Error] E2065 Unsatisfied forward or external declaration: '__llmul'
[DCC Error] E2065 Unsatisfied forward or external declaration: '_malloc'
[DCC Error] E2065 Unsatisfied forward or external declaration: '_free'
[DCC Error] E2065 Unsatisfied forward or external declaration: '_realloc'
[DCC Error] E2065 Unsatisfied forward or external declaration: '_memcpy'
[DCC Error] E2065 Unsatisfied forward or external declaration: '__llumod'
[DCC Error] E2065 Unsatisfied forward or external declaration: '__lludiv'
[DCC Error] E2065 Unsatisfied forward or external declaration: '_memmove'
[DCC Error] E2065 Unsatisfied forward or external declaration: '_memcmp'
[DCC Error] E2065 Unsatisfied forward or external declaration: '__llshl'
[DCC Error] E2065 Unsatisfied forward or external declaration: '__llshr'
[DCC Error] E2065 Unsatisfied forward or external declaration: '_atol'
[DCC Error] E2065 Unsatisfied forward or external declaration: '_strlen'
[DCC Error] E2065 Unsatisfied forward or external declaration: '_qsort'
[DCC Error] E2065 Unsatisfied forward or external declaration: '__llushr'
[DCC Error] E2065 Unsatisfied forward or external declaration: '__turboFloat'
Why is needed to implement the Borland C++ runtime functions in pure pascal(or asm)?
Can’t those linked in the obj directly?
Some of them are already implemented in System.pas but yet the compiler complains?
The rational behind doing this mysqlf instead of using SynSQLite3 or DIXml is the following:
-
SynSQLite3 supports 3.7.8 (I do not see the latest 3.7.9)
-
SynSQLite3 misses some declarations like sqlite3_trace, sqlite_open_v2, etc.
-
SynSQLite2 is around 18 times slower than DIXml 2.4.0 in consequent 20 000 step operations
-
DISQLite3 is paid
-
DISQLite 2.4.0 is fast does 20000 step operations in 260ms but does not support DXE2
-
DISQLite 3.0.0 and 3.1.0 do support DXE2 but are around 8 times slower than 2.4.0
-
I am very curious guy and always try to code as close to the metal as possible.
-
Kudos to SynSQLite3 and DISQLite3 developers – really good work doen so far
Eventually I ended up choosing SynSQLite3 because:
-
It is open source
-
It is very well documented
-
I learned how to recompile sqlite3.obj myself and leave just the needed compilation switches for the features I need
-
I can have the updated 3.7.9 version linked
-
With the fine tuned latest 3.7.9 obj I achieved the speed of DISQLite3
-
The DISQLite3 guy does not have even an email address on his site to write to (just a mailing list), where the SynSQLite3 guys reply in SO on the same hour. This makes sense when choosing one lib over another. Performance and price is not everything.

P.S. My sqlite3.obj is temporaly available for download and test here
Take a look at our Open Source libraries. It implements static linking of sqlite3.obj, and is maintained with the latest version of SQLite3 official code (and features – it is the only framework allowing extended use of the SQLite3 Virtual Tables, for instance). You’ve got a wrapper. But more than that.
Here is how we compile the source into the .obj (one inclusing FTS3, the other without it):
Then take a look at the SynSQLite3.pas unit. It contains some pure pascal or asm version of the needed external files.
For instance:
You’ll find in this unit much more than just a static linking of SQLite3. Note that even if it is used by our mORMot ORM Client-Server framework, this ORM is not required to use the SQLite3 classes. See this article for additional details.
If you are lost into our source code repository (using the great FOSSIL project), read this.