About Social Code
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYonggang Luo <luoyonggang@gmail.com>2025-08-14 18:57:34 +0800
committerMarge Bot <marge-bot@fdo.invalid>2025-08-22 02:05:57 +0000
commitde1a2a3537b3939bf2f9fe7a57e0150b11b76e1b (patch)
tree9e75a0b5b0d6c8dfd99e7488cd4dc407d8253c06
parent39e20ad563409985816855d0ccc407be897cb589 (diff)
util: Remove the __declspec(dllexport) on win32 for PUBLIC export macro
As on Windows, all DLLs are exported use def files, there is no need do __declspec(dllexport) on the function marker. Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36863>
-rw-r--r--src/amd/vulkan/radv_instance.c6
-rw-r--r--src/gallium/frontends/lavapipe/lvp_device.c6
-rw-r--r--src/microsoft/vulkan/dzn_device.c6
-rw-r--r--src/util/macros.h3
-rw-r--r--src/vulkan/runtime/vk_instance.c10
5 files changed, 2 insertions, 29 deletions
diff --git a/src/amd/vulkan/radv_instance.c b/src/amd/vulkan/radv_instance.c
index 609fd156ad1..8e956ceb3e4 100644
--- a/src/amd/vulkan/radv_instance.c
+++ b/src/amd/vulkan/radv_instance.c
@@ -503,12 +503,6 @@ radv_GetInstanceProcAddr(VkInstance _instance, const char *pName)
return vk_instance_get_proc_addr(instance, &radv_instance_entrypoints, pName);
}
-/* Windows will use a dll definition file to avoid build errors. */
-#ifdef _WIN32
-#undef PUBLIC
-#define PUBLIC
-#endif
-
/* The loader wants us to expose a second GetInstanceProcAddr function
* to work around certain LD_PRELOAD issues seen in apps.
*/
diff --git a/src/gallium/frontends/lavapipe/lvp_device.c b/src/gallium/frontends/lavapipe/lvp_device.c
index 7e1d7f7fba8..a099919e750 100644
--- a/src/gallium/frontends/lavapipe/lvp_device.c
+++ b/src/gallium/frontends/lavapipe/lvp_device.c
@@ -1626,12 +1626,6 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL lvp_GetInstanceProcAddr(
pName);
}
-/* Windows will use a dll definition file to avoid build errors. */
-#ifdef _WIN32
-#undef PUBLIC
-#define PUBLIC
-#endif
-
/* The loader wants us to expose a second GetInstanceProcAddr function
* to work around certain LD_PRELOAD issues seen in apps.
*/
diff --git a/src/microsoft/vulkan/dzn_device.c b/src/microsoft/vulkan/dzn_device.c
index 1ceef551493..51643bf19eb 100644
--- a/src/microsoft/vulkan/dzn_device.c
+++ b/src/microsoft/vulkan/dzn_device.c
@@ -1890,12 +1890,6 @@ dzn_GetInstanceProcAddr(VkInstance _instance,
pName);
}
-/* Windows will use a dll definition file to avoid build errors. */
-#ifdef _WIN32
-#undef PUBLIC
-#define PUBLIC
-#endif
-
PUBLIC VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
vk_icdGetInstanceProcAddr(VkInstance instance,
const char *pName)
diff --git a/src/util/macros.h b/src/util/macros.h
index 97efb0272d4..e84f2be13a7 100644
--- a/src/util/macros.h
+++ b/src/util/macros.h
@@ -289,10 +289,11 @@ do { \
/**
* This marks symbols that should be visible to dynamic library consumers.
+ * On win32, symbols use def file to export, do not use __declspec(dllexport)
*/
#ifndef PUBLIC
# if defined(_WIN32)
-# define PUBLIC __declspec(dllexport)
+# define PUBLIC
# elif defined(__GNUC__)
# define PUBLIC __attribute__((visibility("default")))
# else
diff --git a/src/vulkan/runtime/vk_instance.c b/src/vulkan/runtime/vk_instance.c
index 1f21fb08509..c37c577a57b 100644
--- a/src/vulkan/runtime/vk_instance.c
+++ b/src/vulkan/runtime/vk_instance.c
@@ -555,16 +555,6 @@ vk_common_EnumeratePhysicalDeviceGroups(VkInstance _instance, uint32_t *pGroupCo
return vk_outarray_status(&out);
}
-/* For Windows, PUBLIC is default-defined to __declspec(dllexport) to automatically export the
- * public entrypoints from a DLL. However, this declspec needs to match between declaration and
- * definition, and this attribute is not present on the prototypes specified in vk_icd.h. Instead,
- * we'll use a .def file to manually export these entrypoints on Windows.
- */
-#ifdef _WIN32
-#undef PUBLIC
-#define PUBLIC
-#endif
-
/* With version 4+ of the loader interface the ICD should expose
* vk_icdGetPhysicalDeviceProcAddr()
*/