Clean up DLL loading

This commit is contained in:
Camilla Berglund 2015-10-15 02:46:07 +02:00
parent a407a673dd
commit 3795d78b14

View File

@ -65,8 +65,7 @@ static GLFWbool initLibraries(void)
_glfw.win32.winmm.instance = LoadLibraryW(L"winmm.dll"); _glfw.win32.winmm.instance = LoadLibraryW(L"winmm.dll");
if (!_glfw.win32.winmm.instance) if (!_glfw.win32.winmm.instance)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to load winmm.dll");
"Win32: Failed to load winmm.dll");
return GLFW_FALSE; return GLFW_FALSE;
} }
@ -79,24 +78,17 @@ static GLFWbool initLibraries(void)
_glfw.win32.winmm.timeGetTime = (TIMEGETTIME_T) _glfw.win32.winmm.timeGetTime = (TIMEGETTIME_T)
GetProcAddress(_glfw.win32.winmm.instance, "timeGetTime"); GetProcAddress(_glfw.win32.winmm.instance, "timeGetTime");
if (!_glfw.win32.winmm.joyGetDevCaps || _glfw.win32.user32.instance = LoadLibraryW(L"user32.dll");
!_glfw.win32.winmm.joyGetPos || if (!_glfw.win32.user32.instance)
!_glfw.win32.winmm.joyGetPosEx ||
!_glfw.win32.winmm.timeGetTime)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to load user32.dll");
"Win32: Failed to load winmm functions");
return GLFW_FALSE; return GLFW_FALSE;
} }
_glfw.win32.user32.instance = LoadLibraryW(L"user32.dll"); _glfw.win32.user32.SetProcessDPIAware = (SETPROCESSDPIAWARE_T)
if (_glfw.win32.user32.instance) GetProcAddress(_glfw.win32.user32.instance, "SetProcessDPIAware");
{ _glfw.win32.user32.ChangeWindowMessageFilterEx = (CHANGEWINDOWMESSAGEFILTEREX_T)
_glfw.win32.user32.SetProcessDPIAware = (SETPROCESSDPIAWARE_T) GetProcAddress(_glfw.win32.user32.instance, "ChangeWindowMessageFilterEx");
GetProcAddress(_glfw.win32.user32.instance, "SetProcessDPIAware");
_glfw.win32.user32.ChangeWindowMessageFilterEx = (CHANGEWINDOWMESSAGEFILTEREX_T)
GetProcAddress(_glfw.win32.user32.instance, "ChangeWindowMessageFilterEx");
}
_glfw.win32.dwmapi.instance = LoadLibraryW(L"dwmapi.dll"); _glfw.win32.dwmapi.instance = LoadLibraryW(L"dwmapi.dll");
if (_glfw.win32.dwmapi.instance) if (_glfw.win32.dwmapi.instance)