From c3db1cae3f42e36d091532930685222e07796548 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Tue, 1 Nov 2016 19:24:36 +0100 Subject: [PATCH] Fix glfwGetInstanceProcAddress for static linking --- README.md | 2 ++ src/vulkan.c | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a1789595..00be04ea 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,8 @@ information on what to include when reporting a bug. - Bugfix: Calling `glfwMaximizeWindow` on a full screen window was not ignored - Bugfix: `GLFW_INCLUDE_VULKAN` could not be combined with the corresponding OpenGL and OpenGL ES header macros +- Bugfix: `glfwGetInstanceProcAddress` returned `NULL` for + `vkGetInstanceProcAddr` when `_GLFW_VULKAN_STATIC` was enabled - [Win32] Bugfix: Undecorated windows could not be iconified by the user (#861) - [Cocoa] Bugfix: Disabling window aspect ratio would assert (#852) - [Cocoa] Bugfix: Window creation failed to set first responder (#876,#883) diff --git a/src/vulkan.c b/src/vulkan.c index 9908511f..b4e701bd 100644 --- a/src/vulkan.c +++ b/src/vulkan.c @@ -240,7 +240,13 @@ GLFWAPI GLFWvkproc glfwGetInstanceProcAddress(VkInstance instance, return NULL; proc = (GLFWvkproc) vkGetInstanceProcAddr(instance, procname); -#if !defined(_GLFW_VULKAN_STATIC) +#if defined(_GLFW_VULKAN_STATIC) + if (!proc) + { + if (strcmp(procname, "vkGetInstanceProcAddr") == 0) + return (GLFWvkproc) vkGetInstanceProcAddr; + } +#else if (!proc) proc = (GLFWvkproc) _glfw_dlsym(_glfw.vk.handle, procname); #endif