From b4d9a6c80f62f768d17e3173147c5de11efb5726 Mon Sep 17 00:00:00 2001 From: Tobin Ehlis Date: Wed, 13 May 2015 11:57:18 -0600 Subject: loader: On Windows disable global optimization for API entrypoints Without this change, on a Windows Release build, mhook is unable to hook the entrypoint functions. --- loader/trampoline.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/loader/trampoline.c b/loader/trampoline.c index f31bd647..2f255fbd 100644 --- a/loader/trampoline.c +++ b/loader/trampoline.c @@ -24,6 +24,12 @@ #include "loader.h" +#if defined(WIN32) +// On Windows need to disable global optimization for function entrypoints or +// else mhook will not be able to hook all of them +#pragma optimize( "g", off ) +#endif + /* Trampoline entrypoints */ LOADER_EXPORT VkResult VKAPI vkGetPhysicalDeviceInfo(VkPhysicalDevice gpu, VkPhysicalDeviceInfoType infoType, size_t* pDataSize, void* pData) { @@ -1138,3 +1144,7 @@ LOADER_EXPORT VkResult VKAPI vkQueuePresentWSI(VkQueue queue, const VkPresentInf return disp->QueuePresentWSI(queue, pPresentInfo); } + +#if defined(WIN32) +#pragma optimize( "", on ) +#endif -- cgit v1.2.3