Recently, I have been doing C ++ jobs and the interface is built with C #.ProgramThe core of the processing is the DLL written in native C ++. The whole program is compiled in vs2010. At first, we found that everything was running normally during the development and testing of the three computers, but when it was sent to others for running, when the interface of WPF calls the DLL written in C ++, the system will pop up. dllnotfoundexception error. I put the DLL in the directory of system32 and EXE and found that the problem persists.
A lot of Chinese websites do not seem to find a solution... later I saw it on a foreign website. The possible reasons for this are:
1. Whether the DLL function is correctly exported. This can be run on some computers, which indicates that the function has been correctly exported.
2. Whether the import method is correct.
[ dllimport ( " gdipluslibrary. DLL " , entrypoint = " imageeffects " )]
Public Static Extern Intptr Imageeffects ( Intptr Bitmap , Ref Parameter Param );
The export method is as above and can be run on the developer's computer, so the above issues are not considered.
3. Check whether the DLL depends on any other DLL.Code, No other DLL is called.
So where is the problem? Later, according to everyone's idea, I used depends to view the DLL Runtime Library and found that the DLL needed msvcr100.dll! I did not call it, nor did I select MFC. Why.
In this case, the computer running the DLL needs to install the VC 2010 Runtime library, and then re-compile the DLL with vs 2008, now, no error occurs on the computer that has installed the VC ++ 2008 Runtime Library.
Summary:
The incredible DLL cannot be loaded. Check whether the DLL requires other DLL. Although you have not called other DLL, it is not guaranteed that your compiler will secretly generate code to call other DLL. If the above problem occurs, you can try to install the VC Runtime Library and solve the problem!