Sign in Join

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

Mailing lists / lazarus / 2014-07

Where do lazarus apps look for dll's?

14 messages · 8 people · –

Reply by email Subscribe to this list Your subscription

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

Donald Ziesig

Hi All!

Untill yesterday, I had a lazarus app on Windows that worked fine with PostgreSQL. Now it keeps telling me it can't find libpq.dll. I have put libpq.dll in every directory that was recommend on many websites (e.g., in the app directory, in Windows\System32, Windows\SysWOW64, etc.) but I keep getting the error message when I try to start the app, and in the IDE when I try to connect the TPConnect component. I've rebooted every time I copy the dll just in case.

The pgAdmin III app works fine and sees all the tables and their contents so Postgres is working properly.

I even re-installed Lazarus (and put the dll in it's directory)

Any ideas?

Thanks in advance,

Don Ziesig

Reply by email

Maxim Ganetsky
to Donald Ziesig

01.08.2014 1:31, Donald Ziesig ?????:

Show quoted text 16 lines
Hi All! Untill yesterday, I had a lazarus app on Windows that worked fine with PostgreSQL. Now it keeps telling me it can't find libpq.dll. I have put libpq.dll in every directory that was recommend on many websites (e.g., in the app directory, in Windows\System32, Windows\SysWOW64, etc.) but I keep getting the error message when I try to start the app, and in the IDE when I try to connect the TPConnect component. I've rebooted every time I copy the dll just in case. The pgAdmin III app works fine and sees all the tables and their contents so Postgres is working properly. I even re-installed Lazarus (and put the dll in it's directory) Any ideas?

64-bit DLL versus 32-bit application or vice versa?

Best regards, Maxim Ganetsky mailto:

Reply by email

Donald Ziesig
to Maxim Ganetsky
Maxim Ganetsky wrote 19 lines
01.08.2014 1:31, Donald Ziesig ?????: > Hi All! > > Untill yesterday, I had a lazarus app on Windows that worked fine with > PostgreSQL. Now it keeps telling me it can't find libpq.dll. I have put > libpq.dll in every directory that was recommend on many websites (e.g., > in the app directory, in Windows\System32, Windows\SysWOW64, etc.) but I > keep getting the error message when I try to start the app, and in the > IDE when I try to connect the TPConnect component. I've rebooted every > time I copy the dll just in case. > > The pgAdmin III app works fine and sees all the tables and their > contents so Postgres is working properly. > > I even re-installed Lazarus (and put the dll in it's directory) > > Any ideas? 64-bit DLL versus 32-bit application or vice versa?

I will double check, but why would it change over night?

Reply by email

Reinier Olislagers
to Donald Ziesig
Donald Ziesig wrote
I will double check, but why would it change over night?

No idea but at least putting 32 bit libs in System32 or 64 bits in syswow64 as you said you have done is a big no-no. So it's a good idea to make sure you clean up incorrect bitness dlls...

Reply by email

Frederic Da Vitoria
to Reinier Olislagers

2014-08-01 2:02 GMT+02:00 Reinier Olislagers :

Show quoted text 6 lines
On 01/08/2014 01:38, Donald Ziesig wrote: > I will double check, but why would it change over night? No idea but at least putting 32 bit libs in System32 or 64 bits in syswow64 as you said you have done is a big no-no. So it's a good idea to make sure you clean up incorrect bitness dlls...

This http://stackoverflow.com/questions/195590/locating-a-file-on-the-path should enable you to check if the dll can be accessed from your Lazarus app's working directory.

Frederic Da Vitoria (davitof) Membre de l'April - ? promouvoir et d?fendre le logiciel libre ? - http://www.april.org -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20140801/5ef52d4d/attachment-0001.html>

Reply by email

Sven Barth
to Michael Schnell
"Michael Schnell" wrote 8 lines
On 08/01/2014 12:45 AM, Maxim Ganetsky wrote: > > > 64-bit DLL versus 32-bit application or vice versa? > (Why) does this not result in a more specific error message ? (How) can the calling program know about the "bittiness" of a dll / so it

tries to load ?

One *could* differentiate it. Windows.LoadLibrary() returns ERROR_MOD_NOT_FOUND if the file does not exist and ERROR_BAD_EXE_FORMAT if the file is not a PE file or the architecture does not match.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20140801/b7e56354/attachment.html>

Reply by email

payl
to Michael Schnell: (Why) does this not result in a more specific error message ? (How) can the calling…
(How) can the calling program know about the "bittiness" of a dll / so it tries to load ?

http://msdn.microsoft.com/en-us/library/windows/desktop/ms680313(v=vs.85).aspx

There is just field that tells what is architecture of file. This applies both to EXE and DLL.
You can see msdn has x86,x64 and itanium there, but there are many more existing.
In Linux situation is same, it also uses COFF and this field (AFAIK).

Reply by email

Donald Ziesig
to Michael Schnell

Hi Again!

Thanks for all of the excellent suggestions.

After further investigation, it appears that the error message//is***misleading*. Lazarus *IS* finding libpq.dll, but it is not able to load it because *OTHER *system-level dll's that libpq depends on are missing. As mentioned before, it is possible that Windows Update caused the problem, but I haven't been able to confirm that yet.

I'll post the solution here when I find it.

After I get rid of all of the extraneous versions of libpq that I have scattered around my system ;-) .

Don Ziesig

Michael Schnell wrote 23 lines
On 08/01/2014 02:49 PM, Sven Barth wrote: > > One *could* differentiate it. Windows.LoadLibrary() returns > ERROR_MOD_NOT_FOUND if the file does not exist and > ERROR_BAD_EXE_FORMAT if the file is not a PE file or the architecture > does not match. > > Nice ! But I suppose One *should* only differentiate if it can be done with other OSes, as well. . -Michael -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20140801/37545d28/attachment.html>

Reply by email

Sven Barth
to payl: http://msdn.microsoft.com/en-us/library/windows/desktop/ms680313(v=vs.85).aspx There is…
"payl" wrote
> > (How) can the calling program know about the "bittiness" of a dll / so

it tries to load ?

http://msdn.microsoft.com/en-us/library/windows/desktop/ms680313(v=vs.85).aspx

There is just field that tells what is architecture of file. This applies

both to EXE and DLL.

You can see msdn has x86,x64 and itanium there, but there are many more

existing.

In Linux situation is same, it also uses COFF and this field (AFAIK).

Linux uses ELF, not PE/COFF.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20140801/6bfaefe5/attachment.html>

Reply by email

Sven Barth
to Donald Ziesig: Hi Again! Thanks for all of the excellent suggestions. After further investigation, it…
"Donald Ziesig" wrote 6 lines
Hi Again! Thanks for all of the excellent suggestions. After further investigation, it appears that the error message is

misleading. Lazarus IS finding libpq.dll, but it is not able to load it because OTHER system-level dll's that libpq depends on are missing. As mentioned before, it is possible that Windows Update caused the problem, but I haven't been able to confirm that yet.

Download Dependency Walker. It's normally distributed with Windows SDKs, but also available separately. With it you can check which libraries are missing (and even if some imports can't be resolved).

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20140801/e69874f4/attachment.html>

Reply by email