Nader Abbasi

Nader Abbasi

  • NA
  • 55
  • 25.8k

System.DllNotFoundException in C# when use a native C++ dll

Jul 9 2014 2:48 AM
Hi everyone
I have a native C++ dll. Its closed source. I want to use it in my C# app, So I have to wrap the main dll with a class in C++. and I use this new wrapper dll in my C# app. please attention:
++) The main dll (that is closed source) called Engine.dll include the [int Init(UINT32 flag)] method.
I builed a C++ dll called DllWrapper.dll that use the above method, like bellow:
extern "C"
{
               __declspec(dllexport) int Init(UINT32 flag, int *result)
               {
                           // use the APIs of the Engine.dll
               }
}
And in my C# app I use this dll. So in my machine (dev machine) the app is fine work. But when I copy the app and all required dll (all path is correct) in other machines and when I run the app, the following exception raised:
System.DllNotFoundException: Unable to load DLL "DllWrapper.dll": The specified module could not be found. (Exception from HRESULT: 0x8007007E)
 
p/s: I use the VS 2013 IDE.
Can any one help me?
Thanks in advanced.

Answers (3)