Recent

Author Topic: Error running an application using SQLite3 DLL on Windows Embedded systems  (Read 13117 times)

ertank

  • Sr. Member
  • ****
  • Posts: 274
Hello,

I have an application developed with Lazarus. I already have a sqlite3ce.dll v3.9.2 for CE which works just fine under OS "Microsoft Windows CE Version 6.0" for several years.

Now, I have to distribute same application on Windows Embedded Systems. But;
1) CE OS 5.2.29354 device: Intermec CK3R, runs fine for first time after a device boot and then gives me error saying "Can not load SQLite client library "sqlite3ce.dll", Check your installation.".
2) CE OS 5.2.29040 device: Motorola MC55A, runs fine for first time after a device boot. Then gives same error. Then runs for each second trial followed by an error (Run OK, Error, Run OK, Error, Run OK, Error, ...)

Both devices; if application is run. It runs perfectly. No issues at all.

I have recompiled my own application using below Lazarus and fpc versions
- Lazarus 1.7 compiled with sources from "trunk" revision 53505
- fpc 3.0 compiled with source from "fixes_3_0" revision 33986

I do not know If I need to unload SQLite DLL library by code. or, I need a specific DLL for Windows Embedded systems.

One last thing is, I have below code hack to run PAGMA on SQLite3:
Code: [Select]
type
  TSQLite3Connection = class(sqlite3conn.TSQLite3Connection)
  protected
    procedure DoInternalConnect; override;
  end;

...

procedure TSQLite3Connection.DoInternalConnect();
begin
  inherited;
  execsql('PRAGMA page_size=4096');
  execsql('PRAGMA journal_mode=MEMORY');
  execsql('PRAGMA temp_store=2');  // MEMORY TEMP STORE
  execsql('PRAGMA locking_mode=EXCLUSIVE');
end;

I check if file exist and assign client DLL and open SQLite database if file is present. If no file, application displays a message and simply exits.

my debug log contains below lines:
Code: [Select]
[FORMS.PP] ExceptionOccurred
  Sender=EInOutError
  Exception=Can not load SQLite client library "sqlite3ce.dll". Check your installation.
  Stack trace:
  $002179A4
  $00219A1C
  $000517A8
  $00038EC8
TApplication.HandleException Can not load SQLite client library "sqlite3ce.dll". Check your installation.
  Stack trace:
  $002179A4
  $00219A1C
  $000517A8
  $00038EC8

Any help is appreciated.

Thanks & regards.

P.S. I mistakenly post this question in Widgetset\WinCE forum. Could not delete my post in there. Sorry for double posting.
« Last Edit: December 04, 2016, 02:02:04 pm by ertank »

Thaddy

  • Hero Member
  • *****
  • Posts: 14201
  • Probably until I exterminate Putin.
Re: Error running an application using SQLite3 DLL on Windows Embedded systems
« Reply #1 on: December 04, 2016, 01:15:29 pm »
rename your sqlite3.dll sqlite3ce.dll AS PER THE ERROR MESSAGE!

sqlite3ce.dll.... you say you have sqlite3.dll

You can also adapt the header, but renaming the dll is quicker.
« Last Edit: December 04, 2016, 01:20:05 pm by Thaddy »
Specialize a type, not a var.

ertank

  • Sr. Member
  • ****
  • Posts: 274
Re: Error running an application using SQLite3 DLL on Windows Embedded systems
« Reply #2 on: December 04, 2016, 02:00:54 pm »
Hi Thaddy,

Sorry for confusing post and providing two different filenames in my post. Actually, that filename is already "sqlite3ce.dll" on the device and in my application code. There is no problem of that. Moreover, in my code, I test if file exists then try to open a database.

Lastly, same code and same DLL works on "Microsoft Windows CE Version 6.0"

P.S. Just fixed double filename problem in my original post.
« Last Edit: December 04, 2016, 02:02:46 pm by ertank »

Thaddy

  • Hero Member
  • *****
  • Posts: 14201
  • Probably until I exterminate Putin.
Re: Error running an application using SQLite3 DLL on Windows Embedded systems
« Reply #3 on: December 04, 2016, 03:14:23 pm »
WINCE 6.0 is from 2006 (at least on my HP PocketPC) and armv3/armv4 only. Maybe R3 has support for more modern arm's That may be the problem. You may try to run on a more modern arm and armv3 is  for sure not a compatible architecture and for armv4 only armv4T is somewhat compatible. So you may need a recompiled dll for your archtecture and ABI. It can also be that your current embedded CE is running on a completely different architecture, like Intel or AVR.
« Last Edit: December 04, 2016, 03:20:10 pm by Thaddy »
Specialize a type, not a var.

ertank

  • Sr. Member
  • ****
  • Posts: 274
Re: Error running an application using SQLite3 DLL on Windows Embedded systems
« Reply #4 on: December 05, 2016, 06:46:11 am »
I honestly cannot track which version is released when as naming of WinCE is changing a lot. Below are some screen captures from both devices.

I also think that I may need a new DLL. Problem is I do not know what specifics it should have. Moreover, I do not know how to compile a DLL targeting for WinCE as my current DLL is obtained from this forum.

Device working OK using Samsung Electronics, Cortex A-8-S5PV210 CPU: http://i67.tinypic.com/n2kcc4.jpg
Desktop is something like: http://i64.tinypic.com/15eu883.jpg

Device giving me trouble is using ARM Cortex-A8 OMAP3 CPU: http://i66.tinypic.com/20zsk8y.jpg
Desktop is something like: http://i66.tinypic.com/2q23lhc.jpg
Start menu is completely different: http://i68.tinypic.com/rveg6u.jpg

P.S. I could not attach 5 files so I am providing links and attachments as many as allowed.

ertank

  • Sr. Member
  • ****
  • Posts: 274
Re: Error running an application using SQLite3 DLL on Windows Embedded systems
« Reply #5 on: December 05, 2016, 08:04:52 am »
I just test with below code and I confirm that *second* run after device boot is raising error as Application cannot load DLL into memory. I do not see any message on the screen displaying 'DLL Load failed' text at all.

No problem with first run after boot. It always runs OK.

Code: [Select]
procedure TDM.DataModuleCreate(Sender: TObject);
var
  dllHandle: THandle;
begin
  dllHandle := LoadLibrary('sqlite3ce.dll');
  if dllHandle = 0 then
  begin
    ShowMessage('DLL Load failed:' + dllHandle.ToString());
  end
  else
  begin
    ShowMessage('DLL Load OK');
    FreeLibrary(dllHandle);
  end;
end;

ertank

  • Sr. Member
  • ****
  • Posts: 274
Re: Error running an application using SQLite3 DLL on Windows Embedded systems
« Reply #6 on: December 16, 2017, 12:51:12 pm »
Hello,

Finally core problem could be found. It turned out that I have to use ARM compiled sqlite dll and not ARMV4i.

Even Motorola device above have ARMV5 capable cpu OS is not using it or maybe Motorola special WinCE build. I am not sure. But, reason is as it is written above.

 

TinyPortal © 2005-2018