Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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
0
Question by erang · Feb 17, 2016 at 09:40 PM · windowsdllnative pluginc++

What is the correct location for a native (C++) plugin's DLL dependencies

I have built a native Unity plugin (for deployment on Windows) in C++. This plugin (a DLL) itself depends on a number of other DLLs. So for example let's call my plugin MyPlugin.dll, and assume it depends on another DLL called Dep.dll.

I understand that MyPlugin.dll should go into the Assets/Plugins/x86 folder (it's a 32 bit plugin in my case). The question is what is the right location for Dep.dll. Assume that Dep.dll is not in my system path.

As far as I can tell there are two options:

  1. Place Dep.dll in the root folder of the project

  2. Place Dep.dll alongside my plugin in Assets/Plugins/x86

For running in the Unity Editor, both options work. However, interestingly when trying option (1) Unity prints the following error to debug console (but besides the appearance of the error, it actually still works!)

Failed to load 'Assets/Plugins/x86/MyPlugin.dll' with error 'The specified module could not be found. ', GetDllDirectory returned ''. If GetDllDirectory returned non empty path, check that you're using SetDirectoryDll correctly.

Things get more complicated when building & deploying the standalone Windows application. If I use option (2) above then the DLLs get deployed to APP_Data/Plugins (assuming APP is the deployed application name). And the app doesn't work because Dep.dll presumably is not found at runtime. (The way I can make this work is to create a batch file which first appends APP_Data/Plugins to the system path, prior to running the app).

Alternatively if Dep.dll is kept alongside the app's EXE then it does work, though aesthetically it would be nicer if I could hide Dep.dll in the plugins folder with the rest of the DLLs

So I guess my question is whether there is some way (using SetDllDirectory?) to allow me to keep Dep.dll with all other DLLs under the plugins folder, and still have it found at runtime, without having to add it to system path using a wrapper batch file or anything?

Thanks

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by umair_hassan · Jun 06, 2016 at 11:02 AM

Hi, If it helps, this is what I did to get mine working (Windows 7, Unity 5.3.4f1, Google VR SDK for Unity v0.8): 1. Close Unity Completely 2. Using the file browser, navigate to your projects: Assets\Plugins\ 3. Delete the x86_64 folder (The only thing in this folder was the previous audioplugingvrunity.dll) 4. If you have x86_64.meta file, delete that too. 5. Open up your unity project and re-import the package.

At that point, it imported properly and was detected properly as well.

Comment
Add comment · 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.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

How to step into a native C++ dll in Visual Studio? 0 Answers

Native Plugin Cleanup 0 Answers

Texture2D manipulation in c++ dll Plugin 0 Answers

Native Plugin works in editor but not in build 0 Answers

DllNotFound Exception on Editor but works on Standalone 0 Answers


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