loadlibrary error when trying to load a dll for a matlab compiled application

57 vues (au cours des 30 derniers jours)
ss
ss le 13 Mar 2024
Commenté : ss le 22 Mar 2024
I created a Matlab compiled application which calls a dll using loadlibrary. The compiled application works fine in my local machine and load library gets executed fine. But the compiled application doesn't work in another machine and errors out at loadlibrary. I have almost tried everything I could. But still feel there might be a missing dependency. Need help in resolving as the compiled application works fine in my local machine and I have made sure the other machine where it doesnt work has same environment and everything else.

Réponses (1)

Vandit
Vandit le 22 Mar 2024
Hello ss,
I understand that you are encountering an issue with MATLAB compiled application, especially with the "loadlibrary" function when running on a different machine. Here are several steps that you can take to resolve this issue:
  1. Although you have mentioned ensuring the same environment on both machines, it is sometimes easy to overlook subtle differences. Please ensure the MATLAB Runtime version is the same on both machines. Also, check that the application, MATLAB Runtime and the DLL all match in being either 32-bit or 64-bit. This can help identify any compatibility issues.
  2. Use tools like Dependency Walker or Microsoft's Process Explorer to ensure all dependencies of your DLL, including indirect ones, are present on the target machine.
  3. Try running the application as an administrator on the target machine to rule out permission issues. Also, verify that no antivirus or security software on the target machine is blocking the DLL.
  4. If your DLL was built with a specific version of Visual C++, the corresponding Visual C++ Runtime might be required on the other machine. Ensure that the correct version is installed.
Hope this helps.
  1 commentaire
ss
ss le 22 Mar 2024
Hello Vandit,
Thanks for you answer. I was able to resolve the issue.
I was not able to find any the missing dependencies using Dependency Walker. It is slow and buggy. MATLAB support recommended me to use Dependencies which is an open source rewrite of dependency walker:
That worked for me as it looked like I was missing msvcp110 and msvcr110. That resolved the issue for me.

Connectez-vous pour commenter.

Catégories

En savoir plus sur C Shared Library Integration dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by