Search Unity

Build looking for DLL in odd places

Discussion in 'Windows' started by MrMonkeylicious, Mar 4, 2019.

  1. MrMonkeylicious

    MrMonkeylicious

    Joined:
    Nov 19, 2017
    Posts:
    1
    I have a DLL that Unity can find in the editor just fine that connects to some custom periphreals. When I do a build it places My_API64.dll in the plugins directory.

    When I go to run the build it has these errors in the log:
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/My_API_64.dll
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/My_API_64.dll
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/My_API_64.dll
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/My_API_64
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/My_API_64.dll
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/My_API_64
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/libMy_API_64.dll
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/libMy_API_64.dll
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/libMy_API_64.dll
    OpenVR Shutdown

    (Filename: Line: 1461)

    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/My_API_64.dll
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/My_API_64.dll
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/My_API_64.dll
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/My_API_64
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/My_API_64.dll
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/My_API_64
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/libMy_API_64.dll
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/libMy_API_64.dll
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/libMy_API_64.dll
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/My_API_64.dll
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/My_API_64.dll
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/My_API_64.dll
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/My_API_64
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/My_API_64.dll
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/My_API_64
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/libMy_API_64.dll
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/libMy_API_64.dll
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/libMy_API_64.dll
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/My_API_64.dll
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/My_API_64.dll
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/My_API_64.dll
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/My_API_64
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/My_API_64.dll
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/My_API_64
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/libMy_API_64.dll
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/libMy_API_64.dll
    Fallback handler could not load library D:/Work/Demo 2019/Build/Demo (HTC Vive)_Data/Mono/libMy_API_64.dll

    When I copy over the DLL into those 3 spots, the demo works but has a crash that I can't duplicate in the editor. So first things first, I'm trying to figure out why it would be looking for DLLs in those three random-seeming spots, rather than just the plugins folder.

    The only place the DLL is referenced is in a series of 30-40 DLLImport calls to manage calls to its various functions. The DLL is referenced the same way, with no path, in all of my DLLImport calls.

    An example:

    [DllImport("My_API_64.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "my_initAPI")]
    public static extern void initMyApi();
     
  2. KinuxUnity

    KinuxUnity

    Joined:
    Dec 4, 2015
    Posts:
    6
    Hello MrMonkeylicious,

    not sure if it is relaled, but I have a c++ dll compiled with vs2017 that is called via dllimport calls, and for some reason it works in unity editor/windows , but not within a window build. I have no idea why. By the way it seems that it is not working either ineditor with unity version 2019.1.

    the same c++ dll that works in the editor seems to crash on a cpp "dynamic_cast" in the standalone build. I have the RTTI enabled. If someone has an idea... Thank you in advance.
     
    MrMonkeylicious likes this.
  3. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    6,417
    Can you post sample code of where it crashes? How does it crash? Is it an access violation?