Sign in Join

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

Mailing lists / lazarus / 2008-09

LoadLibrary on WinCE

5 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Pavel Řezníček

Dear developers,

On Lazarus v0.9.25 r16541 i386-win32-win32/win64, the LoadLibrary function fails on WinCE.

I tried to load libpq.dll and sqlite3.dll with no success.

I have the ARM/WinCE libraries in the same directory as my executable (even in the \gdb folder). All accompanying libraries, *.dll and *.lib, for libpq.dll I have also there.

I tried to load the libraries myself using a full absolute path (e. g., ExtractFilePath(ParamStr(0)) + 'libpq.dll').

You can test it on the PQConnection component (try the .Connect property). Of course you should have the libpq.dll file for WinCE.

An alternative way is just to load some library you find on your WinCE system, let's say (untested code):

procedure Form1.Button1Click(Sender: TObject);
var LibHandle: HInst;
begin
    LibHandle := Windows.LoadLibrary('mylibrary.dll')
    ShowMessage(IntToStr(LibHandle));
    LibHandle := Windows.LoadLibrary(ExtractFilePath(ParamStr(0)) +
'mylibrary.dll')
    ShowMessage(IntToStr(LibHandle));
end;

That's it. If you have the same bug you'll get both handles of zero value (meaning the loading wasn't successful).

I wonder why just a simple thing as calling an API function would fail. Maybe because the core library from that the LoadLibrary function is imported also fails to load??

Any clue how to get it working?

Pavel ?ezn??ek

Reply by email

Joost van der Sluis
to Pavel Řezníček

Op dinsdag 16-09-2008 om 21:16 uur [tijdzone +0200], schreef Pavel ?ezn??ek:

On Lazarus v0.9.25 r16541 i386-win32-win32/win64, the LoadLibrary function fails on WinCE.

Did you use fpc 2.2.2?

I tried to load libpq.dll and sqlite3.dll with no success.

sqlite3.dll works here as a charm. TSQLite3connection also works.

Show quoted text 9 lines
I have the ARM/WinCE libraries in the same directory as my executable (even in the \gdb folder). All accompanying libraries, *.dll and *.lib, for libpq.dll I have also there. I tried to load the libraries myself using a full absolute path (e. g., ExtractFilePath(ParamStr(0)) + 'libpq.dll'). You can test it on the PQConnection component (try the .Connect property). Of course you should have the libpq.dll file for WinCE.

Did you try any other software that uses this library on WinCE?

Show quoted text 21 lines
An alternative way is just to load some library you find on your WinCE system, let's say (untested code): procedure Form1.Button1Click(Sender: TObject); var LibHandle: HInst; begin LibHandle := Windows.LoadLibrary('mylibrary.dll') ShowMessage(IntToStr(LibHandle)); LibHandle := Windows.LoadLibrary(ExtractFilePath(ParamStr(0)) + 'mylibrary.dll') ShowMessage(IntToStr(LibHandle)); end; That's it. If you have the same bug you'll get both handles of zero value (meaning the loading wasn't successful). I wonder why just a simple thing as calling an API function would fail. Maybe because the core library from that the LoadLibrary function is imported also fails to load?? Any clue how to get it working?

I woudn't be suprised if all files must be in the application's directory.

Joost.

Reply by email

Pavel Řezníček
to Joost van der Sluis

Joost van der Sluis napsal(a):

Show quoted text 9 lines
Op dinsdag 16-09-2008 om 21:16 uur [tijdzone +0200], schreef Pavel ?ezn??ek: > On Lazarus v0.9.25 r16541 i386-win32-win32/win64, the LoadLibrary > function fails on WinCE. > Did you use fpc 2.2.2?

No, fpc 2.2.3 only.
Now I have reverted to v0.9.25 r15862 i386-win32-win32/win64 with fpc 2.2.3 but it works fine.

Show quoted text 5 lines
> I tried to load libpq.dll and sqlite3.dll with no success. > sqlite3.dll works here as a charm. TSQLite3connection also works.

For me, neither.

Show quoted text 13 lines
> I have the ARM/WinCE libraries in the same directory as my executable > (even in the \gdb folder). All accompanying libraries, *.dll and *.lib, > for libpq.dll I have also there. > > I tried to load the libraries myself using a full absolute path (e. g., > ExtractFilePath(ParamStr(0)) + 'libpq.dll'). > > You can test it on the PQConnection component (try the .Connect > property). Of course you should have the libpq.dll file for WinCE. > Did you try any other software that uses this library on WinCE?

Yes, an example program shipped with the libpq library works well.

Show quoted text 27 lines
> An alternative way is just to load some library you find on your WinCE > system, let's say (untested code): > > procedure Form1.Button1Click(Sender: TObject); > var LibHandle: HInst; > begin > LibHandle := Windows.LoadLibrary('mylibrary.dll') > ShowMessage(IntToStr(LibHandle)); > LibHandle := Windows.LoadLibrary(ExtractFilePath(ParamStr(0)) + > 'mylibrary.dll') > ShowMessage(IntToStr(LibHandle)); > end; > > That's it. If you have the same bug you'll get both handles of zero > value (meaning the loading wasn't successful). > > I wonder why just a simple thing as calling an API function would fail. > Maybe because the core library from that the LoadLibrary function is > imported also fails to load?? > > Any clue how to get it working? > I woudn't be suprised if all files must be in the application's directory. Joost.

Yes, WinCE is pretty strange, i. e. it does not support the "current directory" natively - as I read somewhere.
It's also strange that you had success loading the libraries, as well as me when I came back to an older snapshot. What's the difference between these two ones? If you figured out what exactly should I compare maybe I could send you a diff.

Pavel

Reply by email

Joost van der Sluis
to Pavel Řezníček

Op donderdag 18-09-2008 om 23:47 uur [tijdzone +0200], schreef Pavel ?ezn??ek:

Show quoted text 5 lines
> Did you use fpc 2.2.2? > No, fpc 2.2.3 only. Now I have reverted to v0.9.25 r15862 i386-win32-win32/win64 with fpc 2.2.3 but it works fine.

You gave the lazarus-revision number. But do you also know which fpc-revision number that is? Kan you give the fpc-revision which does work (the old one) and the one that doesn't?

Joost.

Reply by email

Pavel Řezníček
to Joost van der Sluis

Joost van der Sluis napsal(a):

Show quoted text 16 lines
Op donderdag 18-09-2008 om 23:47 uur [tijdzone +0200], schreef Pavel ?ezn??ek: >> Did you use fpc 2.2.2? >> >> > No, fpc 2.2.3 only. > Now I have reverted to v0.9.25 r15862 i386-win32-win32/win64 with fpc > 2.2.3 but it works fine. > You gave the lazarus-revision number. But do you also know which fpc-revision number that is? Kan you give the fpc-revision which does work (the old one) and the one that doesn't? Joost.

Hello Jost,

I'm very sorry but for this while I can give only some information that could guide you to the FPC revision numbers.

The new one was installed from this snapshot:
Lazarus-0.9.25-16541-fpc-2.2.3-20080911-win32.exe. WinCE: Lazarus-0.9.25-16541-fpc-2.2.3-20080911-cross-arm-wince-win32.exe. The old one and working is from this:
Lazarus-0.9.25-fpc-2.2.3-20080725-win32.exe.
WinCE: Lazarus-0.9.25-fpc-2.2.3-20080725-cross-arm-wince-win32.exe.

The older, working compiler I have recently installed says: Free Pascal Compiler version 2.2.3 [2008/07/25] for i386

Would this be sufficient? A second sorry: I didn't find on the wiki how to get the exact release number of FPC in time... neither from the command line help... Is there some other numbering than just the date?

Pavel

Reply by email