DllNotfoundExeption

I try to use an external hardware with my game.
Manufacturer provided me a dll and a C# sample for Visual studio. I also get probleme to find dll.
After installing c++ 2010 x86 redistributable, sample find dll and works well under visual studio.
Now i try to use it in Unity 5.1.3. I get the DllNotfoundException.
I try several topics, but not find something that works…
Is somebody have a similar probleme?

It’s a long thread but it might help if you’re stuck.

I already tested a lot of solutions proposed in your link and put ddl in differents folder.

I also tried things like this :

String currentPath = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Process);
        String dllPath = Environment.CurrentDirectory + Path.DirectorySeparatorChar + "Assets" + Path.DirectorySeparatorChar + "Plugins";
        if(currentPath.Contains(dllPath) == false)
        {
            Environment.SetEnvironmentVariable("PATH", currentPath + Path.PathSeparator + dllPath, EnvironmentVariableTarget.Process);
        }

I tried to use dependency walker. but i’m not sure to understand: it seems that Dependency Walker searching for a lot of -MS-Win- dlls that should be in his own forder .

What is curious is that it works with the C# Sample that Manufacturer sent me.

Does unmanaged dlls works in Unity 5 free?

Unfortunately, DllNotFoundException does not provide a lot of information about which dll is not found. .net might be complaining about your dll or it might be complaining about another dependency. Dependency walker can help you figure out all the assemblies your application needs. The tough part is filtering out all the system assemblies that are in registered locations.

If you’re certain you know which assembly is causing the exception, I’d say give fuslogvw a shot, to see if you can find out why it can’t be laoded. Unfortunately, I’ve never tried using the fusion log tool on unmanaged assemblies, so I’m not sure it will provide useful debug information. As a last resort, you could try using Process Monitor to detect attempts to find/access your dll.

I’m not sure about that. Hopefully someone else can clarify.

I also tried this tutorial :
http://ericeastwood.com/blog/17/unity-and-dlls-c-managed-and-c-unmanaged
but same result, i can’t find dll :frowning:

Edit : tutorial works thanks to : Update to Unity 5, then DllNotFoundException: sqlite3 - Questions & Answers - Unity Discussions