Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to load DLL ' mydll.dll': The specified module could not be found

On my laptop, where I am developing the WPF application, everything works fine, debug and launch the .exe app.

My app uses a native DLL, for resolve the reference problem I add the DLL in bin/debug (release) folder. I access it using DllImport like this:

[DllImport("xptodll.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int LDA_About();

The problem is when I try to run the .exe app on another PC, when I need to access the DLL it crashes. I make a handle to log any unhandled exceptions and the following error appears:

Unable to load DLL ' xptodll.dll': The specified module could not be found. Exception from HRESULT: 0x8007007E)

The bin/debug directory has xptodll.dll, and app files: .exe, .application, .exe.config, .exe.manifest, .pdb.

Maybe this is important, the xptodll.dll interacts with hardware, but why wouldn´t it have the same behaviour on both machines?

like image 223
Cristóvão Macedo Avatar asked Dec 03 '22 00:12

Cristóvão Macedo


1 Answers

There is probably some further dependency that is failing. My guess is that xptodll.dll itself has dependencies on other libraries that are missing on the failing machine. The documentation of xptodll.dll should explain what dependencies are needed. If the documentation does not make it obvious what is missing, you can diagnose the problem yourself using Dependency Walker.

like image 132
David Heffernan Avatar answered Dec 06 '22 11:12

David Heffernan