Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

DllNotfoundExeption

Discussion in 'Scripting' started by benjaminver89, Oct 21, 2015.

  1. benjaminver89

    benjaminver89

    Joined:
    May 14, 2015
    Posts:
    30
    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?
     
    Last edited: Oct 21, 2015
  2. eisenpony

    eisenpony

    Joined:
    May 8, 2015
    Posts:
    971
  3. benjaminver89

    benjaminver89

    Joined:
    May 14, 2015
    Posts:
    30
    I already tested a lot of solutions proposed in your link and put ddl in differents folder.

    I also tried things like this :

    Code (CSharp):
    1. String currentPath = Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Process);
    2.         String dllPath = Environment.CurrentDirectory + Path.DirectorySeparatorChar + "Assets" + Path.DirectorySeparatorChar + "Plugins";
    3.         if(currentPath.Contains(dllPath) == false)
    4.         {
    5.             Environment.SetEnvironmentVariable("PATH", currentPath + Path.PathSeparator + dllPath, EnvironmentVariableTarget.Process);
    6.         }
    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.
     
  4. benjaminver89

    benjaminver89

    Joined:
    May 14, 2015
    Posts:
    30
    Does unmanaged dlls works in Unity 5 free?
     
  5. eisenpony

    eisenpony

    Joined:
    May 8, 2015
    Posts:
    971
    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.
     
  6. benjaminver89

    benjaminver89

    Joined:
    May 14, 2015
    Posts:
    30
    Last edited: Oct 22, 2015