Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2018-10

Cannot use SQLite 64 bit dll

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Dennis

Using Lazarus and FPC and sqlite3conn unit, I can use the sqlite3.dll on windows without problem.

However, when I try to convert my project to win 64, it just fail without any warning.

I am using
    FPC 3.1.1 Revision 63034
    Lazarus 1.9.0
    both are Win64

I download the win 64 bit version of sqlite3.dll from https://www.sqlite.org/2018/sqlite-dll-win64-x64-3250200.zip and place it in the same folder as my exe.

The project compiles without errors nor warning.

But when I run the exe, it just waits a few seconds and then quits silently.

I tried debugging it and set breakpoints at all of  the following in
sqlite3.inc
function TryInitializeSqlite(const LibraryName: UnicodeString): Integer;
function InitialiseSQLite:integer;
function  InitializeSQLiteANSI(const LibraryName: AnsiString):integer;
function  InitializeSQLite(const LibraryName: UnicodeString) :integer;
function  InitialiseSQLite(const LibraryName: UnicodeString):integer;
and the following in SQLite3Conn:
class function TSQLite3ConnectionDef.DefaultLibraryName: string;
class function TSQLite3ConnectionDef.LoadedLibraryName: string;
class function TSQLite3ConnectionDef.LoadFunction: TLibraryLoadFunction;

However, the debugger did not stop at all at any of them.

What could possibly be the cause of the problem?

Dennis

Reply by email

Sven Barth
to Dennis
Dennis wrote 36 lines
Using Lazarus and FPC and sqlite3conn unit, I can use the sqlite3.dll on windows without problem. However, when I try to convert my project to win 64, it just fail without any warning. I am using     FPC 3.1.1 Revision 63034     Lazarus 1.9.0     both are Win64 I download the win 64 bit version of sqlite3.dll from https://www.sqlite.org/2018/sqlite-dll-win64-x64-3250200.zip and place it in the same folder as my exe. The project compiles without errors nor warning. But when I run the exe, it just waits a few seconds and then quits silently. I tried debugging it and set breakpoints at all of  the following in sqlite3.inc function TryInitializeSqlite(const LibraryName: UnicodeString): Integer; function InitialiseSQLite:integer; function  InitializeSQLiteANSI(const LibraryName: AnsiString):integer; function  InitializeSQLite(const LibraryName: UnicodeString) :integer; function  InitialiseSQLite(const LibraryName: UnicodeString):integer; and the following in SQLite3Conn: class function TSQLite3ConnectionDef.DefaultLibraryName: string; class function TSQLite3ConnectionDef.LoadedLibraryName: string; class function TSQLite3ConnectionDef.LoadFunction: TLibraryLoadFunction; However, the debugger did not stop at all at any of them. What could possibly be the cause of the problem?

A simple test here with a SQLite3Connection works without problems.

Do you get an exception if the library is *not* located in the same folder? In that case it loaded correctly and something else must be the problem.

Regards,
Sven

Reply by email

Dennis
to Sven Barth

A simple test here with a SQLite3Connection works without problems.

Show quoted text 8 lines
Do you get an exception if the library is *not* located in the same folder? In that case it loaded correctly and something else must be the problem. Regards, Sven _______________________________________________

I deleted the library from the exe folder and surprisingly it behaved exactly the same. it just waited a few seconds before quitting silently. No except was thrown.
I suspect the exe tries to link to the sqlite dll somewhere in the search path, which is a 32 bit version, so it quits silently after finding out it is not a 64 bit dll.

How can I force SQLite3Connection to first look for the dll in the exe folder instead of from the search path?

Dennis

Reply by email

Michael Van Canneyt
to Dennis
Dennis wrote 18 lines
A simple test here with a SQLite3Connection works without problems. > > Do you get an exception if the library is *not* located in the same > folder? In that case it loaded correctly and something else must be > the problem. > > Regards, > Sven > _______________________________________________ I deleted the library from the exe folder and surprisingly it behaved exactly the same. it just waited a few seconds before quitting silently. No except was thrown. I suspect the exe tries to link to the sqlite dll somewhere in the search path, which is a 32 bit version, so it quits silently after finding out it is not a 64 bit dll. How can I force SQLite3Connection to first look for the dll in the exe folder instead of from the search path?

That should be the case automatically.

You can also use a TSQLDBLibraryLoader component to specify the library location exactly. If you use lazarus, it's on the component palette.

Michael.

Reply by email