DllNotFoundException in Unity, but working properly outside Unity

Viewed 167

I have created a C++ DLL that is imported in a C# DLL. This C# DLL is again put in to the Assets folder of my Unity project, and I get the DllNotFoundException for the C++ DLL.

I have already tested that the C++ DLL import works, by creating a sample Visual Studio C# project and importing the same C++ DLL (from the same location) and using the function inside.

Inside C#, I import the C++ DLL as follows:

[DllImport("C:\\Users\\me\\Documents\\TestForNativeDLL.dll", EntryPoint = "test", CallingConvention = CallingConvention.StdCall)]

What are some reasons why this works for a sample C# project, but not in Unity? I have set all platform target to x86.

0 Answers
Related