0

I have written a db app using Delphi 10.4 Community and Zeos db components, client server using MySQL 8.0.27 server. I have this app running on 5 computers as clients on the same local network. The issue is I have set up a new computer which I set up identical to the other clients, but when I try to connect app to DB, I get the "libmysql.dll found, but could not be loaded. Check compile-target and library compatibility!" msg. The app is compiled as a 32bit app, the libmysql.dll is the 32bit version. All computers are running Windows 10 64bit OS. Nothing is different on the new computer that I can detect. I can even try to run the app on new computer across the network from another computer's exe folder and get the same error. My application's zConnection1.LibraryLocation is set to the apps exe folder, and that is where the dll resides on all computers.

Anyone have a clue as to what might be amiss?
Thanks much! Doug

svtdoug
  • 15
  • 3
  • 1
    No, the computers are **not** identical - that's the very point. To make sure you're really loading the file you intend to, rename the DLL and (of course) load it under its new name. If that's not possible then assure **no other libmysql.dll** exists on the PC of issue. – AmigoJack Jul 25 '22 at 00:09
  • Use [Dependency Walker](http://www.dependencywalker.com/) to check the details about the DLL loading from your app. – Delphi Coder Jul 25 '22 at 04:58
  • As a side-note; How to check which DLLs are loaded: Download `Process Explorer` from SysInternals. Run it. Enable the Lower Pane with **View > Show Lower Pane** then **View > Lower Pane View > DLLs**. Then find your executable and click on it. It will show the DLLs being used by your EXE. Get the `libmysql.dll` and see inisde the "Path" column which dll it actually loaded. I think you can also do this in the IDE through **View > Debug Windows > Modules**. This obviously only works for DLLs that are actually loaded and not failed attempts.... – Blurry Sterk Jul 25 '22 at 07:20
  • `Process Monitor` from SysInternals on the other hand can help you identify which files your executable are trying to access. This might help you identify the DLL it tried to load – Blurry Sterk Jul 25 '22 at 07:21
  • AmigoJack - I've searched for other libmysql.dll files on problem computer. Only one is the correct one in the exe folder. – svtdoug Jul 25 '22 at 20:00
  • Delphi Coder - I used Dependency Walker and it found libmysql to be 32bit version. – svtdoug Jul 25 '22 at 20:01
  • Blurry Sterk - thanks for tip on Process Explorer. Ran it and unfortunately, because the dll won't load, it does not show up in the list of DLL's. On other machines which work fine the libmysql.dll shows up and the path is fine. Still stuck. – svtdoug Jul 25 '22 at 22:38
  • Do Windows' logs tell anything? Is the PC of issue surely not running anything that interferes (anti virus)? Is the program executed outside any `Program Files*` folder? Can you debug it (otherwise telling us "_Delphi_" is pretty pointless if you don't have the source)? – AmigoJack Jul 26 '22 at 19:24
  • Thanks AmigoJack. Good suggestions, but no luck. Turned anti virus and firewall off, still won't load libmysql.dll. Checked event log, nothing. Tried running in Program Files* folder, no change. I even tried compiling my app to 64 bit and using the 64bit libmysql - now this is interesting - it runs fine on my development machine, but now issue can be replicated on another laptop when running the 64 bit version of app and dll. 32bit version is still fine on this laptop. New computer still throwing error with both 32 & 64 bit versions. At least this gives me another data point. – svtdoug Jul 26 '22 at 22:24
  • I'll see if I can set up my development environment on laptop where it produces error to try debugging. – svtdoug Jul 26 '22 at 22:24
  • Hi Doug, did you find a solution? Same problem here: Small test program should only loay mysql dll and connect to database. Works on some computers, on others I get " found bot could not be loaded". Same Program with same dll works on other machines. – Heinzi Tuberkel Apr 05 '23 at 08:00

0 Answers0