From 180ef2f598ee306c525ebb246eb9aca0b5bae516 Mon Sep 17 00:00:00 2001 From: Nikolai Siukosev Date: Tue, 9 Jan 2024 12:13:37 +0400 Subject: [PATCH] Added VULKAN_HPP_NO_WIN32_PROTOTYPES preprocessor condition (#1756) * Added VULKAN_HPP_NO_WIN32_PROTOTYPES preprocessor condition which disables dynamic loader type declaration for win32 * Added VULKAN_HPP_NO_WIN32_PROTOTYPES README.md section --- README.md | 5 +++++ snippets/includes.hpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d0aab3d..8d34763 100644 --- a/README.md +++ b/README.md @@ -925,6 +925,11 @@ By defining ```VULKAN_HPP_NO_SMART_HANDLE``` before including vulkan.hpp, the he With C++20, the so-called spaceship-operator ```<=>``` is introduced. If that operator is supported, all the structs and classes in vulkan.hpp use the default implementation of it. As currently some implementations of this operator are very slow, and others seem to be incomplete, by defining ```VULKAN_HPP_NO_SPACESHIP_OPERATOR``` before including vulkan.hpp you can remove that operator from those structs and classes. +#### VULKAN_HPP_NO_WIN32_PROTOTYPES + +By default, if ```VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL``` is enabled on Win32, ```vulkan.hpp``` declares ```HINSTANCE```, ```LoadLibraryA```, and other required symbols. It could cause conflicts with the ```Windows.h``` alternatives, such as ```WindowsHModular```. +With this define, you can disable these declarations, but you will have to declare them before the ```vulkan.hpp``` is included. + #### VULKAN_HPP_RAII_NO_EXCEPTIONS If both, VULKAN_HPP_NO_EXCEPTIONS and VULKAN_HPP_EXPECTED are defined, the vk::raii-classes don't throw exceptions. That is, the actual constructors are not available, but the creation-functions must be used. For more details have a look at the vk_raii_ProgrammingGuide.md. diff --git a/snippets/includes.hpp b/snippets/includes.hpp index 9f80577..c85c75f 100644 --- a/snippets/includes.hpp +++ b/snippets/includes.hpp @@ -25,7 +25,7 @@ #if VULKAN_HPP_ENABLE_DYNAMIC_LOADER_TOOL == 1 # if defined( __unix__ ) || defined( __APPLE__ ) || defined( __QNX__ ) || defined( __Fuchsia__ ) # include -# elif defined( _WIN32 ) +# elif defined( _WIN32 ) && !defined( VULKAN_HPP_NO_WIN32_PROTOTYPES ) typedef struct HINSTANCE__ * HINSTANCE; # if defined( _WIN64 ) typedef int64_t( __stdcall * FARPROC )();