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/][1]
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][2]
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 ##
I 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).
[1]: https://code.google.com/p/moveframework/
[2]: http://forum.unity3d.com/threads/191966-Fallback-handler-could-not-load-Library-Unity-4-2-OSX-10-8-4-standalone
↧