Page 1 of 1

[solved] Error sqlite3.dll use by Zeos

Posted: 06.08.2012, 14:07
by Sapiem
Greetings:

Having a sqlite3.dll in system folders (windows, system32, etc.) has priority than our own distributed application that normally put in the folder for our app. I've noticed this since I have in my app folder is the last of the original distro site sqlite.com yet when I call the function to see the version (using Delphi) informs me that version is lower, and this corresponds to the dll distributed by other applications such as Opera, Adobe, etc already installed previously.

How I can force Zeos to use the dll that is in the folder of my app and not the dll that exist in default system folders?

Thanks

Posted: 13.08.2012, 00:17
by EgonHugeist
Sapiem,

Now i don't know which revision do you use.. IF you checkout http://svn.code.sf.net/p/zeoslib/code-0 ... es/testing with TortoiseSVN then you can use TZConnection.LibraryLocation := 'C:\yourDir\sqlite3.dll'. This drops the default locations and you can use the dll you want to use..

Michael

Posted: 22.12.2012, 06:35
by IndianaJones
@Egon, are you sure that link is working cos I have tested that package but I got the following error.

In File 'C:\lazarus-libs\zeos\src\plain\ZPlainLoader.pas' at line 221:
raise Exception.Create(Format(SLibraryNotFound, [TriedLocations]));

Tested with the FPC 2.6.1
Lazarus 1.1 - SVN 39433
Windows 7 - 64Bit
Sqlite3 32 Bit DLL

Posted: 22.12.2012, 11:32
by EgonHugeist
IndianaJones,

i'm sure. The Exception you get happens if the library isn't compatible (32Bit vs. 64Bit) or can't be found.

Copy the 32Bit Library to Windows\SYSWOW64 or copy the 64Bit dll to Windows\system32. I know this is confusing but Microsoft makes the rules. On the other hand it IS possible to load the sqlite3.dll with TZConnection.LibraryLocation := '....'; I know with Postgre it won't work, because PostgreSQL uses some more DLL's.

Please check the dll you're trying to load is compatible and the patch+name is right.

Posted: 22.12.2012, 17:21
by IndianaJones
I copied the 32 bit DLL to the C:\Windows\SysWOW64 directory but the same error occurs again. Also I tried the following code without success. While debugging the error occurs at the ZConnection1.Connect; line.

procedure TForm1.FormActivate(Sender: TObject);
begin
libpath:=GetcurrentDir+PathDelim+'sqlite3.dll';
dbPath:=GetCurrentDir+PathDelim+'example.db';
ZConnection1.LibraryLocation:=libpath;
ZConnection1.Protocol:='sqlite-3';
ZConnection1.HostName:='localhost';
ZConnection1.Database:=dbPath;
ZConnection1.Connect;
if ZConnection1.Connected then
ShowMessage('Connected...')
else
ShowMessage('Not Connected...');
end;

Posted: 22.12.2012, 21:43
by EgonHugeist
IndianaJones,

what's your compiling target? 64Bit or 32Bit?

Posted: 22.12.2012, 22:05
by IndianaJones
@Egon,
I resolved the case, my old fpc is 2.6.1 64Bit, so in this case the error occurs. So I changed the fpc with 32Bit. Now the same source works just fine.
what should be the problem? Can I or you report that issue?
Thanks for your help.

Posted: 23.12.2012, 11:24
by EgonHugeist
IndianaJones,

you can't load a 32Bit dll with an 64Bit application and vice versa, by an generic way. This is where you've to take care about compatibility. On the Lazarus forum they call it 'dll-hell'. A nice expression for a thread which pops up again and again and the answers are allways the same..

Posted: 23.12.2012, 18:16
by IndianaJones
Thanks for the clarification.