- Home /
Failed to load dll error
Hello all,
I created a C++ dll in Visual Studio 2010 which depends on another dll. I have tested this new dll in VS and everything works as expected. I put these files into Unity 5.1.0f3 and the project is able to build. When I try to run it, I get the following error:
Failed to load 'Assets/Plugins/x86_64/myFile.dll' with error 'The operation completed successfully.', GetDllDirectory returned ''. If GetDllDirectory returned non empty path, check that you're using SetDirectoryDll correctly.
It seems Unity can find the file but cannot open/read it. Since it cannot open the file I later receive the DllNotFoundException error.
Some troubleshooting options I have already tried:
-Putting the dependent dll in the base unity.exe folder
-Downloading the 32 and 64 bit VS 2010 and 2013 (just to be safe) Redistributable files
-I am using 64-bit editor with 64-bit dll
-Creating a wrapper for the dll to call from unity script
Does anyone know what I can do to fix this?
Thanks in advance
I'm not sure, but have you tried putting the dependent dll with your dll in /Assets/Plugins/x86_64/ ?
Yes, I have tried all sorts of combinations of locations to put the dependent and/or independent dll.
Once I had similar problem because of $$anonymous$$cAfee antivirus.
I, too, have similar issue with HBAO plugin (see http://forum.unity3d.com/threads/nvidia-hbao-image-effect-sample-project.296591/page-2#post-2218197). The interesting part is, that the DLL is still working despite the printed error. However, I really would like to know how to get rid of the error.
I have a similar problem with a C++ DLL I created, but the major difference is that my DLL works properly when I call into it, despite the error message.
As others have said, it only seems to happen with C++ DLLs that have dependencies that aren't already loaded.
I believe this is a bug in Unity, as the error message only started appearing in 5.1. The exact same DLL and import code don't report this error message in 5.0.
I submitted a bug report to Unity a while back - hopefully it gets patched soon.
Answer by bugmagnet · Jul 05, 2017 at 08:44 PM
Make sure you are not building your DLL with the 'Debug' specification and instead building in Release!
Yes! I've spent hours trying to figure this out. Rebuilding my c++ project in release configuration worked. Thanks. I feel stupid.
Answer by Dave-Carlile · Jun 24, 2015 at 09:03 PM
This stack overflow answer looks like it may help.
Your answer
Follow this Question
Related Questions
DllNotFoundException in Mac Editor; Not Build, Not Windows 0 Answers
Can't build error - dll is not allowed to be included or could not be found. 3 Answers
How to use Yeppp! in Unity? 1 Answer
Execute editor window scripts when project errors are present 0 Answers
How to resolve "Multiple Precompiled Assemblies" error 0 Answers