"DllNotFoundException: Unable to load DLL 'kernel32.dll': The specified module could not be found. Error.
private class ThreadJasonDll {
private static string DLL_LOCATION = System.IO.Path.Combine(Application.streamingAssetsPath, "ThreadJasonDll.dll");
private IntPtr pDll; public ThreadJasonDll() {
Debug.Log(DLL_LOCATION);
pDll = NativeMethods.LoadLibrary (DLL_LOCATION);
int error = Marshal.GetLastWin32Error();
if (error != 0) {
Debug.Log("LoadLibrary error: " + error);
}IntPtr pInitialize = NativeMethods.GetProcAddress (pDll, "Initialize");
CallInitialize = (DllInitialize)Marshal.GetDelegateForFunctionPointer (pInitialize, typeof(DllInitialize));
IntPtr pApplyMotionInput = NativeMethods.GetProcAddress(pDll, "ApplyMotionInput");}
This is the major part of the code. I am trying to access the ThreadJasonDll.dll . This project is working fine in unity and also in the .exe build. But when I took the WebGl build, I got this error. Can any one please help me.
While printing the DLL_LOCATION, I am getting the correct path also. I copied that path and put it in browser. It goes to the dll location. But still I am getting this error and due to this, the major part is missing in my project.
Answer by Landern · Dec 23, 2015 at 04:00 PM
The Editor and your windows build(.exe) have access to the local file system. WebGL doesn't offer access to your file system (browsers specifically don't allow this behavior by default, the security/privacy ramifications aren't hard to think out), if it did then "rogue" websites could troll for files with ease. So you can't load windows system file kernel32.dll from within a web browser.
@Landern So how could I solve my current issue? Could you please help me..