Failed to load DLL 'mydll.dll': the specified module was not found

On my laptop, where I am developing a WPF application, everything works fine, debugs and runs the .exe application.

My application uses a native DLL, to solve the link problem, I add the DLL to the bin / debug (release) folder. I access it using DllImport as follows:

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

The problem is that I try to run the .exe application on another PC when I need to access the DLL with which it crashes. I make a pen 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 contains xptodll.dll and application files: .exe, .application, .exe.config, .exe.manifest, .pdb.

Maybe this is important, xptodll.dll interacts with the hardware, but why not have the same behavior on both machines?

+4
source share
2 answers

There is probably some additional dependency that fails. I assume that xptodll.dll itself has dependencies on other libraries that are missing from the failover machine. The xptodll.dll documentation should explain what dependencies are needed. If there is no obvious flaw in the documentation, you can diagnose the problem yourself using Dependency Evasion .

+15
source

Another problem could be (besides all this, "put the DLL in the right place") if the DLL was created using Visual Studio, for example. Visual Studio 2012 must also be installed VCR-accessible for 64-bit (vcredist_x64.exe), which is used by Visual Studio.

+2
source

Source: https://habr.com/ru/post/1382046/


All Articles