- Home /
Fallback handler could not load library on Windows 8
I am making a game in Unity Pro which uses an external C++ DLL.
The HARDWARE_INTERFACE.DLL is wrapped into a class like this:
class HARDWARE
{
[DllImport("HARDWARE_INTERFACE")]
public static extern bool HARDWARE_Open() ;
}
The DLL itself is located in Assets/Plugins/.
This is working fine in the editor, and also in a generic Windows build on the development machine which runs Windows 7. In the build, the DLLs are in unity_app/unity_app_Data/Plugins/.
However if I transfer the build to a Windows 8 Desktop machine, the log yields
Fallback handler could not load library C:/Users/user/Desktop/unity_app/unity_app_Data/Mono/.\C:/Users/user/Desktop/unity_app/unity_app_Data/Plugins/HARDWARE_INTERFACE.dll
Fallback handler could not load library C:/Users/user/Desktop/unity_app/unity_app_Data/Mono/.\C:/Users/user/Desktop/unity_app/unity_app_Data/Plugins/HARDWARE_INTERFACE
Fallback handler could not load library C:/Users/user/Desktop/unity_app/unity_app_Data/Mono/libC:/Users/user/Desktop/unity_app/unity_app_Data/Plugins/HARDWARE_INTERFACE.dll
Fallback handler could not load library C:/Users/user/Desktop/unity_app/unity_app_Data/Mono/.\libC:/Users/user/Desktop/unity_app/unity_app_Data/Plugins/HARDWARE_INTERFACE.dll
Fallback handler could not load library C:/Users/user/Desktop/unity_app/unity_app_Data/Mono/libC:/Users/user/Desktop/unity_app/unity_app_Data/Plugins/HARDWARE_INTERFACE.dll
Fallback handler could not load library C:/Users/user/Desktop/unity_app/unity_app_Data/Mono/.\C:/Users/user/Desktop/unity_app/unity_app_Data/Plugins/HARDWARE_INTERFACE.dll
Fallback handler could not load library C:/Users/user/Desktop/unity_app/unity_app_Data/Mono/.\C:/Users/user/Desktop/unity_app/unity_app_Data/Plugins/HARDWARE_INTERFACE
Fallback handler could not load library C:/Users/user/Desktop/unity_app/unity_app_Data/Mono/libC:/Users/user/Desktop/unity_app/unity_app_Data/Plugins/HARDWARE_INTERFACE.dll
Fallback handler could not load library C:/Users/user/Desktop/unity_app/unity_app_Data/Mono/.\libC:/Users/user/Desktop/unity_app/unity_app_Data/Plugins/HARDWARE_INTERFACE.dll
Fallback handler could not load library C:/Users/user/Desktop/unity_app/unity_app_Data/Mono/libC:/Users/user/Desktop/unity_app/unity_app_Data/Plugins/HARDWARE_INTERFACE.dll
DllNotFoundException: C:/Users/user/Desktop/unity_app/unity_app_Data/Plugins/HARDWARE_INTERFACE.dll
at (wrapper managed-to-native) HARDWARE:HARDWARE_Open ()
It looks as if the whole path to the DLL (`C:/Users/user/Desktop/unity_app/unity_app_Data/Plugins/HARDWARE_INTERFACE.dll`) is being appended to the search paths (`C:/Users/user/Desktop/unity_app/unity_app_Data/Mono/`, C:/Users/user/Desktop/unity_app/unity_app_Data/Mono/lib), which of course is nonsense.
How can I make Unity / Mono find the DLLs on the Windows 8 machine?
Any hints will be appreciated.
Did you ever figure out the answer? Because I have the exact same problem here.
I figured it out. For anyone in the future who is also running into this problem: in my case this was solved by changing the Unity project's architecture from x86_64 to just plain x86. It turned out the dll I was importing wasn't x64 compatible, so check for that. Also, I needed to manually copy the .dll to the same folder where my game's executable resided. Once I did this everything worked.
Your answer
Follow this Question
Related Questions
Windows 8 - DLLNotFoundException. Windows 7 - No problems! 0 Answers
UnauthorizedAccessException when accessing DLL 1 Answer
There's a way to define platform specific assets? 2 Answers
Glow/Spotlight shader reacting different cross-platform 1 Answer
Unity Standard asset Cross Platform Input Manager and mouse input 0 Answers