Search Unity

Question Failed to load dll - UWP - Dll path duplicated

Discussion in 'Windows' started by Yafilo, Apr 19, 2021.

  1. Yafilo

    Yafilo

    Joined:
    Jun 6, 2017
    Posts:
    4
    Hi,
    I'm importing a native DLL (compiled in aarch64 release mode with make) that I import in Unity for ARM64 (Hololens2 with UWP), with the right parameters in the inspector.
    On the Hololens, the dll is placed in :
    C:/Data/Users/DefaultAccount/AppData/Local/DevelopmentFiles/Template3DVS.Release_ARM64.immersion/AprilTagARM64.dll 


    But when I run it I got the error :
    The Dll fails to load : Failed to load : '
    C:/Data/Users/DefaultAccount/AppData/Local/DevelopmentFiles/Template3DVS.Release_ARM64.immersion/C:/Data/Users/DefaultAccount/AppData/Local/DevelopmentFiles/Template3DVS.Release_ARM64.immersion/AprilTagARM64.dll.dll', expected ARM64 architecture, but was Unknown architecture. You must recompile your plugin for ARM64 architecture
    .

    As you can see the path to the dll is duplicated, so I presume the dll is not find by Unity, of course there is no dll placed in the (duplicated) path described by the error... Does anyone has an idea ?

    Thank you.
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    I think this might be just a bug in the error message. It does this before displaying the error message:
    Code (csharp):
    1. GetApplicationFolder() + '/' + pluginPath + ".dll"
    How are you loading it? Does it work if you try to load it in a non-Unity UWP app on HoloLens?
     
  3. Yafilo

    Yafilo

    Joined:
    Jun 6, 2017
    Posts:
    4
    I forgot to mention that with another dll compiled with Visual studio (same ARM64), the dll is placed in the same folder and Unity find this one (even when there is an error, the path is correct). I call them with :
    Code (CSharp):
    1. [DllImport("DllName", EntryPoint = "entry"]
    2. static extern void Test();
    So you think that the problem comes from the dll which has an Unknown architecture ?
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    Yeah. However, I don't think it's an architecture folder, but rather how you compiled it. You said you used make to build it... what compiler and linker flags did you specify?
     
  5. Yafilo

    Yafilo

    Joined:
    Jun 6, 2017
    Posts:
    4
    I used aarch64-linux-gcc but I guess that it is not compatible with UWP ...
     
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    Are you trying to run a Linux binary on UWP? That will not work. You need to build against Windows SDK, define "WINAPI_FAMILY=WINAPI_FAMILY_APP" and use "/APPCONTAINER" linker flag (or whatever the equivalent for gcc is).