From 93f4effd2bad6d19a9ad9dc46545634cb9de90c9 Mon Sep 17 00:00:00 2001 From: John Bartholomew Date: Wed, 1 May 2013 13:08:09 +0100 Subject: [PATCH] Do not export internal symbols from a unix shared library. --- CMakeLists.txt | 3 +++ include/GL/glfw3.h | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c292ed8..5f5634ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,6 +77,9 @@ endif() #-------------------------------------------------------------------- if (BUILD_SHARED_LIBS) set(_GLFW_BUILD_DLL 1) + if (UNIX OR APPLE) + add_definitions(-fvisibility=hidden) + endif() endif() #-------------------------------------------------------------------- diff --git a/include/GL/glfw3.h b/include/GL/glfw3.h index 791ae55f..cd6da9e4 100644 --- a/include/GL/glfw3.h +++ b/include/GL/glfw3.h @@ -157,6 +157,10 @@ extern "C" { #define GLFWAPI __declspec(dllimport) #endif +#elif defined(__GNUC__) && defined(_GLFW_BUILD_DLL) + + #define GLFWAPI __attribute__((visibility("default"))) + #else /* We are either building/calling a static lib or we are non-win32 */