Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7006173
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:26:38+00:00 2026-05-27T21:26:38+00:00

I have compiled SQLIte3 database engine from sqlite3.c with BCC 55 using the following

  • 0

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:

  1. It is open source

  2. It is very well documented

  3. I learned how to recompile sqlite3.obj myself and leave just the needed compilation switches for the features I need

  4. I can have the updated 3.7.9 version linked

  5. With the fine tuned latest 3.7.9 obj I achieved the speed of DISQLite3

  6. 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.

SQLite3 Profile Results

P.S. My sqlite3.obj is temporaly available for download and test here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:26:39+00:00Added an answer on May 27, 2026 at 9:26 pm

    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):

    del sqlite3.obj
    \dev\bcc\bin\bcc32 -6 -O2 -c -d -DSQLITE_ENABLE_FTS3 -u- sqlite3.c
    copy sqlite3.obj sqlite3fts3.obj
    \dev\bcc\bin\bcc32 -6 -O2 -c -d -u- sqlite3.c
    

    Then take a look at the SynSQLite3.pas unit. It contains some pure pascal or asm version of the needed external files.

    For instance:

    function _ftol: Int64;
    // Borland C++ float to integer (Int64) conversion
    asm
      jmp System.@Trunc  // FST(0) -> EDX:EAX, as expected by BCC32 compiler
    end;
    
    function _ftoul: Int64;
    // Borland C++ float to integer (Int64) conversion
    asm
      jmp System.@Trunc  // FST(0) -> EDX:EAX, as expected by BCC32 compiler
    end;
    
    function malloc(size: cardinal): Pointer; cdecl; { always cdecl }
    // the SQLite3 database engine will use the FastMM4/SynScaleMM fast heap manager
    begin
      GetMem(Result, size);
    end;
    
    procedure free(P: Pointer); cdecl; { always cdecl }
    // the SQLite3 database engine will use the FastMM4 very fast heap manager
    begin
      FreeMem(P);
    end;
    
    function realloc(P: Pointer; Size: Integer): Pointer; cdecl; { always cdecl }
    // the SQLite3 database engine will use the FastMM4/SynScaleMM very fast heap manager
    begin
      result := P;
      ReallocMem(result,Size);
    end;
    
    function memset(P: Pointer; B: Integer; count: Integer): pointer; cdecl; { always cdecl }
    // a fast full pascal version of the standard C library function
    begin
      result := P;
      FillChar(P^, count, B);
    end;
    
    procedure memmove(dest, source: pointer; count: Integer); cdecl; { always cdecl }
    // a fast full pascal version of the standard C library function
    begin
      Move(source^, dest^, count); // move() is overlapping-friendly
    end;
    
    procedure memcpy(dest, source: Pointer; count: Integer); cdecl; { always cdecl }
    // a fast full pascal version of the standard C library function
    begin
      Move(source^, dest^, count);
    end;
    
    function atol(P: pointer): integer; cdecl; { always cdecl }
    // a fast full pascal version of the standard C library function
    begin
      result := GetInteger(P);
    end;
    
    var __turbofloat: word; { not used, but must be present for linking }
    
    // Borland C++ and Delphi share the same low level Int64 _ll*() functions:
    
    procedure _lldiv;
    asm
      jmp System.@_lldiv
    end;
    
    procedure _lludiv;
    asm
      jmp System.@_lludiv
    end;
    
    procedure _llmod;
    asm
      jmp System.@_llmod
    end;
    
    procedure _llmul;
    asm
      jmp System.@_llmul
    end;
    
    procedure _llumod;
    asm
      jmp System.@_llumod
    end;
    
    procedure _llshl;
    asm
      jmp System.@_llshl
    end;
    
    procedure _llshr;
    asm
    {$ifndef ENHANCEDRTL} // need this code for Borland/CodeGear default System.pas
      shrd    eax, edx, cl
      sar     edx, cl
      cmp     cl, 32
      jl      @@Done
      cmp     cl, 64
      jge     @@RetSign
      mov     eax, edx
      sar     edx, 31
      ret
    @@RetSign:
      sar     edx, 31
      mov     eax, edx
    @@Done:
    {$else}
      // our customized System.pas didn't forget to put _llshr in its interface :)
      jmp System.@_llshr
    {$endif}
    end;
    
    procedure _llushr;
    asm
      jmp System.@_llushr
    end;
    
    function strlen(p: PAnsiChar): integer; cdecl; { always cdecl }
    // a fast full pascal version of the standard C library function
    begin // called only by some obscure FTS3 functions (normal code use dedicated functions)
      result := SynCommons.StrLen(pointer(p));
    end;
    
    function memcmp(p1, p2: pByte; Size: integer): integer; cdecl; { always cdecl }
    // a fast full pascal version of the standard C library function
    begin
      if (p1<>p2) and (Size<>0) then
        if p1<>nil then
          if p2<>nil then begin
            repeat
              if p1^<>p2^ then begin
                result := p1^-p2^;
                exit;
              end;
              dec(Size);
              inc(p1);
              inc(p2);
            until Size=0;
            result := 0;
          end else
          result := 1 else
        result := -1 else
      result := 0;
    end;
    
    function strncmp(p1, p2: PByte; Size: integer): integer; cdecl; { always cdecl }
    // a fast full pascal version of the standard C library function
    var i: integer;
    begin
      for i := 1 to Size do begin
        result := p1^-p2^;
        if (result<>0) or (p1^=0) then
          exit;
        inc(p1);
        inc(p2);
      end;
      result := 0;
    end;
    
    
    function localtime(t: PCardinal): pointer; cdecl; { always cdecl }
    // a fast full pascal version of the standard C library function
    var uTm: TFileTime;
        lTm: TFileTime;
        S: TSystemTime;
    begin
      Int64(uTm) := (Int64(t^) + 11644473600)*10000000; // unix time to dos file time
      FileTimeToLocalFileTime(uTM,lTM);
      FileTimeToSystemTime(lTM,S);
      with atm do begin
        tm_sec := S.wSecond;
        tm_min := S.wMinute;
        tm_hour := S.wHour;
        tm_mday := S.wDay;
        tm_mon := S.wMonth-1;
        tm_year := S.wYear-1900;
        tm_wday := S.wDayOfWeek;
      end;
      result := @atm;
    end;
    

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to select data from the database and I have the following code
I have compiled a .NET application using Any CPU option. This .NET application uses
I have compiled the NTL inifite precision integer arithmetic library for c++, using Microsoft
I am in a big problem ..i have compiled my c files using linux
I have a compiled swf file and a I can't edit it , but
I have the following code: if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) { // Setup the
Hello I have a Sqlite3 database created in my computer and I want to
I have a simple database with about 3900 entries, and am using a generic
I have a javascript code that access a sqlite3 database. I would like to
Iam coding in c and using sqlite3 as database .I want to ask that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.