Reputation: 31
Recently I wrote a small winForm program using C#
language. In the app I use C#
to invoke a "*.dll" file written in C++
. It works all right in my Visual Studio 2012
and on my computer, but when I move it to other computer, it always pops an error about “ Unable to load DLL ' *.dll',can not find specified module.(Exception from HRESULT: 0x8007007E). ”.
I've searched the internet for solution. There are also some similar questions regarding problems that others met and it seems that they also have not found the right solution yet. I also tried some methods like moving my '*.dll' file to windows\system32
or write the app current directory to System Enviroment Variable
, but this also didn't work.
Now I really don't know how to deal with it. So I'll be very appreciative if someone could give some help.
I'm new here and thanks very much.
Upvotes: 3
Views: 3218
Reputation: 1653
Pretty old post but shows up first in Google so I am gonna post my solution to the issue: I was writing a minimal DLL in C++ which I integrated in a minimal C# console application and got the same error that you stated above. The final fix is simple: Your target PC might not have the appropriate VS redistributable package installed. In my case (VS 2013) it was this one here: http://www.microsoft.com/en-us/download/details.aspx?id=40784 for some reason it does not work to copy the required DLLs from the system32 folder manually... what a freak bug taking me half a day to find out. I did not find this anywhere online, will do some cross-posting now...
Upvotes: 1