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:

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:

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

  • 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!



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.


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).

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:



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.

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 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:


IMPORT(int) CLEyeGetCameraCount();


//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.


// DLL Handle  

// Function pointer from dll.

// 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() {
	if (_CLEyeGetCameraCount != NULL) {
		return (*_CLEyeGetCameraCount)();
	return 0;

After the I removed “CLEyeMulticam.lib” from build setting (Linker → Input → Additional Dependencies).


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.