Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
2
Question by ddoubledeuce · Jan 01, 2014 at 06:35 AM · crashdllnotfoundexceptiondll error

Fallback handler could not load library

Hello all, first time asker, long time reader.

I have been using unity for the past couple of years and have never actually had to ask a question, since the forums and UA are so full of information - so this is a first for me.

I'm working on a personal project using the MoveFramework library found here: https://code.google.com/p/moveframework/

The framework consists of a low level library which is distributed as a set of DLLs. There is also a simple example of a C# wrapper that can be used to call into the library.

In fact, this setup seemed to work well - I had it up and running quite nicely with only a little cleanup code in Unity 4.2. Then I decided to upgrade to Unity 4.3, and that's when everything came to a grinding halt. First I started getting DllNotFoundExceptions, which I was eventually able to resolve intermittently (it appears that Unity calls into one of the dlls that I don't have the source for and leaves it running, I found a way to force quit that dll), but now the editor simply crashes when using the library (pressing play). As a matter of fact, it appears to be crashing when loading the library - before any MonoBehavior script calls are made, this seems to be the case as I can't capture anything in the Mono debugger, and trying to capture the Dll initialization in Visual Studio is also not working. I can, however, attach the visual studio debugger to unity and at least get the console output. when the crash occurs, visual studio does break, but with no callstack or disassembly, and a rather bleak "Unhandled exception at 0x0b790c41 in Unity.exe: 0xC0000005: Access violation writing location 0xfffffffc." as if a null or invalid pointer were dereferenced (the memory addresses aren't always the same).

I have since tried to regress back to Unity 4.2, but to no avail.

On the occasion that it doesn't crash it gives me output like this in Visual Studio:

 > 'Unity.exe': Loaded 'C:\Users\Dan\Documents\MoveProject\MF_CWrapper.dll', Symbols loaded.
 > 'Unity.exe': Loaded 'C:\Users\Dan\Documents\MoveProject\MoveManager.dll', Symbols loaded.
 > 'Unity.exe': Loaded 'C:\Users\Dan\Documents\MoveProject\CLEyeMulticam.dll', Binary was not built with debug information.
 > 'Unity.exe': Loaded 'C:\Users\Dan\Documents\MoveProject\hidapi.dll', Cannot find or open the PDB file
 > 'Unity.exe': Loaded 'C:\Windows\SysWOW64\msvcr100.dll', Cannot find or open the PDB file
 > 'Unity.exe': Loaded 'C:\Windows\SysWOW64\msvcp100.dll', Cannot find or open the PDB file
 > 'Unity.exe': Loaded 'C:\Windows\SysWOW64\irprops.cpl', Cannot find or open the PDB file
 > First-chance exception at 0x00000000 in Unity.exe: 0xC0000005: Access violation.
 > 'Unity.exe': Unloaded 'C:\Users\Dan\Documents\MoveProject\MF_CWrapper.dll'
 > 'Unity.exe': Unloaded 'C:\Users\Dan\Documents\MoveProject\MoveManager.dll'
 > 'Unity.exe': Unloaded 'C:\Windows\SysWOW64\irprops.cpl'
 > 'Unity.exe': Unloaded 'C:\Windows\SysWOW64\msvcp100.dll'
 > 'Unity.exe': Unloaded 'C:\Users\Dan\Documents\MoveProject\hidapi.dll'
 > 'Unity.exe': Unloaded 'C:\Windows\SysWOW64\msvcr100.dll'
 > 'Unity.exe': Unloaded 'C:\Users\Dan\Documents\MoveProject\CLEyeMulticam.dll'
 > Fallback handler could not load library C:/Program Files (x86)/Unity/Editor/Data/Mono/lib/MF_CWrapper.dll
 > Fallback handler could not load library C:/Program Files (x86)/Unity/Editor/Data/Mono/lib/.\MF_CWrapper.dll

The "Fallback handler could not load" message will be given with lots of different variations on the MF_CWrapper.dll name (this is the dll called from the C# wrapper), and of course that dll is not in the Editor/Data/Mono/lib folder - putting it there makes no difference and I'm pretty sure it's not supposed to be in there anyway.

The only thing Unity related that I could find concerning that message was: http://forum.unity3d.com/threads/191966-Fallback-handler-could-not-load-Library-Unity-4-2-OSX-10-8-4-standalone

As suggested by the thread above, the application works when built, it just does not work in the editor. Unfortunately that thread didn't matriculate any answers.

Answers to possibly common questions:

  • The dlls that it is trying to load are the correct dlls. When I create a standalone Mono console project to test the above dlls everything works fine - the moves are initialized and the camera starts up and tracking works great. It just is not working at all in Unity any more.

  • I've tried moving the dlls to the Editor folder, to the Unity project folder and the plugins folder - it's not having any problems finding the dlls, just having problems loading them.

  • The functions that are external in the MF_CWrapper.dll are all declared:

    extern "C" __declspec(dllexport)

  • Changing the function declarations results in DllEntryPointNotFound errors due to name mangling.

I've been struggling with this for a couple of days, I sure hope someone has seen something like this with the editor before!

Oh, and Happy New Year!

=Dan

Update

Running the standalone player in the debugger it looks like it's loading the Visual Studio redistributables from the local folder rather than the windows system folder (which is where the Editor loads them from even if they are placed in the local folder). Output from the standalone player:

 'MoveProject.exe': Loaded 'C:\Users\Dan\Documents\MoveProject\MF_CWrapper.dll', Symbols loaded.
 'MoveProject.exe': Loaded 'C:\Users\Dan\Documents\MoveProject\MoveManager.dll', Symbols loaded.
 'MoveProject.exe': Loaded 'C:\Users\Dan\Documents\MoveProject\CLEyeMulticam.dll', Binary was not built with debug information.
 'MoveProject.exe': Loaded 'C:\Users\Dan\Documents\MoveProject\hidapi.dll', Cannot find or open the PDB file
 'MoveProject.exe': Loaded 'C:\Users\Dan\Documents\MoveProject\msvcr100.dll', Cannot find or open the PDB file
 'MoveProject.exe': Loaded 'C:\Users\Dan\Documents\MoveProject\msvcp100.dll', Cannot find or open the PDB file
 'MoveProject.exe': Loaded 'C:\Windows\SysWOW64\irprops.cpl', Cannot find or open the PDB file
 'MoveProject.exe': Loaded 'C:\Windows\SysWOW64\wsock32.dll', Cannot find or open the PDB file

However deleting / renaming the msvcr100.dll and msvcp100.dll to force the editor to load the one in the local folder makes no difference, still crashes in the editor.

TL;DR

have a set of interdependent dlls that work fine in the standalone player but the editor either crashes or reports DllNotFoundException.

The editor will have a variant of "First-chance exception at 0x197d4a49 in Unity.exe: 0xC0000005: Access violation writing location 0x0328dddc" in the stdout when trying to load them (whether it crashes or reports DllNotFoundException).

Comment
Add comment · Show 1
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 TimChen · Aug 22, 2014 at 01:49 PM 0
Share

sorry for resurrect the thread, but I wonder have you figured out the solution eventually?

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by tteneder · Jan 22, 2014 at 07:07 PM

I had problems loading Dlls that depended on other Dlls. Not sure if that's the case with your project but you may read through this post of mine in the forums:

http://forum.unity3d.com/threads/191966-Fallback-handler-could-not-load-Library-Unity-4-2-OSX-10-8-4-standalone?p=1493495#post1493495

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
avatar image
1

Answer by Mondkin · Sep 11, 2015 at 02:26 AM

Hello,

In my case my DLL was working well in the Unity Editor but failing when running in standalone mode.

The problem: mine was a 32-bit DLL and I was generating the executable as: "Windows x86_64", so my game reported that it couldn't find the DLL file at runtime (it could have been a better error message as the file was there, but anyway ...).

All I had to do was to generate the executable as "Windows x86" and it worked.

Hope this helps to someone with the same problem.

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
avatar image
0

Answer by shuichi_saitoh · Jul 11, 2015 at 04:08 PM

I'm using Unity 5.1.1 (32bit) in Windows 8.1 (x64) and tried to integrate moveframework into my app, and I got the same problem.

With several try-and-error, rebuilding the moveframework several times, I finally make it work.

What I see is something wrong in CLEyeMulticam.dll (version 1.6.4.28) file, which supposed to be the latest version as for now, and the CLEyeMulticam.lib (included in the SDK).

When I build the MoveFramework.dll using CLEyeMulticam.lib, I never able to load the dll successfully into the Unity Editor.

So I did change DLL loading method from implicit loading to explicit loading using "LoadLibrary", as like the following.

Changed the CLEyemulticam.h from:

CLEyeMulticam.h

 IMPORT(int) CLEyeGetCameraCount();

to: CLEyeMulticam.h

 //Do not use implicit dll loading.
 //But keep the api same.
 int CLEyeGetCameraCount();


And then, add a new .cpp file (CLEyeMulticam_Load.cpp), just like this.

CLEyeMulticam_Load.cpp

 // DLL Handle  
 HMODULE hModule=NULL;
 
 // Function pointer from dll.
 typedef int (*LPCLEYEGETCAMERACOUNT) ();
 LPCLEYEGETCAMERACOUNT _CLEyeGetCameraCount=NULL;
 
 // Load CLEyeMulticam.dll using LoadLibrary.
 int _init_library() {
     if (hModule != NULL) {
         return 0;
     }
 
     HMODULE hModule = LoadLibrary("CLEyeMulticam.dll");
     if (hModule == NULL) {
         return 0;
     }
 
     _CLEyeGetCameraCount = (LPCLEYEGETCAMERACOUNT) GetProcAddress(hModule, "CLEyeGetCameraCount");
         //Load other functions as the same way.
 
     return 0;
 }
 
 
 // Delegates method to the function pointer.
 int CLEyeGetCameraCount() {
     _init_library();
     if (_CLEyeGetCameraCount != NULL) {
         return (*_CLEyeGetCameraCount)();
     }
     return 0;
 };
 
 

After the I removed "CLEyeMulticam.lib" from build setting (Linker -> Input -> Additional Dependencies).

EDIT

There is one additional thing need to be configured.

Windows DEP (Data Execution Protection) seems prevent loading of the CLEyeMulticam.dll within Unity Editor (failed at LoadLibrary).

So I excluded Unity.exe from the DEP, then I successfully loaded the dll file.

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

22 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Error while running higher versions of Conflunet Kafka inside Unity and while packaging it into an APK 0 Answers

DLL NOT FOUND EXCEPTION even after following procedure 0 Answers

Error while importing confluent packages and bundling it into an APK 0 Answers

DllNotFoundException: sqlite3 Android 6 Marshmallow 4 Answers

Include iDirect.dll in Unity 2017.1,The Assembly UnityEditor is referenced by iDirect ('Assets/IonGFX/iDirect.dll'). But the dll is not allowed to be included or could not be found. 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