From 316273efc8e33362d11a634adff2b97bec7337ee Mon Sep 17 00:00:00 2001 From: moi15moi <80980684+moi15moi@users.noreply.github.com> Date: Fri, 18 Jul 2025 12:51:33 -0400 Subject: [PATCH] fix: don't force -fvisibility=hidden on Windows (#5757) Fix https://github.com/pybind/pybind11/discussions/5750 --- include/pybind11/detail/pybind11_namespace_macros.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/pybind11/detail/pybind11_namespace_macros.h b/include/pybind11/detail/pybind11_namespace_macros.h index 7137fb5f7..bd18c8c0a 100644 --- a/include/pybind11/detail/pybind11_namespace_macros.h +++ b/include/pybind11/detail/pybind11_namespace_macros.h @@ -74,7 +74,7 @@ // requires forcing hidden visibility on pybind code, so we enforce this by setting the attribute // on the main `pybind11` namespace. #if !defined(PYBIND11_NAMESPACE) -# ifdef __GNUG__ +# if defined(__GNUG__) && !defined(_WIN32) # define PYBIND11_NAMESPACE pybind11 __attribute__((visibility("hidden"))) # else # define PYBIND11_NAMESPACE pybind11