• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
Question by kvcwhales001 · Jun 24, 2015 at 08:09 PM · errordlldllnotfoundexception

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

Comment
art_craft_vlad
mgooding
bugmagnet

People who like this

3 Show 8
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Jessespike · Jun 24, 2015 at 08:15 PM 0
Share

I'm not sure, but have you tried putting the dependent dll with your dll in /Assets/Plugins/x86_64/ ?

avatar image kvcwhales001 · Jun 24, 2015 at 08:27 PM 0
Share

Yes, I have tried all sorts of combinations of locations to put the dependent and/or independent dll.

avatar image AntonyBaasan · Jun 24, 2015 at 08:47 PM 0
Share

Once I had similar problem because of McAfee antivirus.

avatar image art_craft_vlad · Jul 23, 2015 at 05:28 PM 1
Share

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.

avatar image mgooding · Sep 13, 2015 at 02:57 PM 1
Share

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.

avatar image oathx mgooding · Dec 15, 2015 at 04:04 AM 0
Share

me too, the bug patches released?

Show more comments

3 Replies

· Add your reply
  • Sort: 
avatar image

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!

Comment
dreamboothmike
GrigoriyChuwak
fbittner
sschimper

People who like this

4 Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image dreamboothmike · Jan 16, 2019 at 05:51 PM 2
Share

Yes! I've spent hours trying to figure this out. Rebuilding my c++ project in release configuration worked. Thanks. I feel stupid.

avatar image

Answer by Dave-Carlile · Jun 24, 2015 at 09:03 PM

This stack overflow answer looks like it may help.

Comment

People who like this

0 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

Answer by chl_unity · May 31, 2016 at 01:22 PM

The DLL dependes on others.

Comment

People who like this

0 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

.DLL can't build for Windows Standalone. 0 Answers

Nor recognizing dll when I build a game 3 Answers

How to get a C++ DLL to work 2 Answers

DllNotFound Exception on Editor but works on Standalone 0 Answers

How to use Yeppp! in Unity? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges