[Lazarus] LoadLibrary on WinCE

Pavel Řezníček cigydd at gmail.com
Thu Sep 18 23:47:10 CEST 2008


Joost van der Sluis napsal(a):
> 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.
>> 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.
>> 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.
>> 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



More information about the Lazarus mailing list