From 0915ba9cb5b469e3d186227ebbecdae6c259d0c2 Mon Sep 17 00:00:00 2001 From: John Stamp Date: Wed, 28 Jul 2010 15:36:33 -0700 Subject: Don't export private symbols Signed-off-by: Lloyd Hilaiel --- CMakeLists.txt | 7 +++++++ src/api/yajl_common.h | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cc6bfbd..727a488 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,6 +62,13 @@ IF (WIN32) SET(CMAKE_C_FLAGS_DEBUG "/D DEBUG /Od /Z7") SET(CMAKE_C_FLAGS_RELEASE "/D NDEBUG /O2") ELSE (WIN32) + IF(CMAKE_COMPILER_IS_GNUCC) + INCLUDE(CheckCCompilerFlag) + CHECK_C_COMPILER_FLAG(-fvisibility=hidden HAVE_GCC_VISIBILITY) + IF(HAVE_GCC_VISIBILITY) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") + ENDIF(HAVE_GCC_VISIBILITY) + ENDIF(CMAKE_COMPILER_IS_GNUCC) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -pedantic -Wpointer-arith -Wno-format-y2k -Wstrict-prototypes -Wmissing-declarations -Wnested-externs -Wextra -Wundef -Wwrite-strings -Wold-style-definition -Wredundant-decls -Wno-unused-parameter -Wno-sign-compare -Wmissing-prototypes") diff --git a/src/api/yajl_common.h b/src/api/yajl_common.h index a227deb..0e75db1 100644 --- a/src/api/yajl_common.h +++ b/src/api/yajl_common.h @@ -49,7 +49,11 @@ extern "C" { # define YAJL_API __declspec(dllimport) # endif #else -# define YAJL_API +# if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303 +# define YAJL_API __attribute__ ((visibility("default"))) +# else +# define YAJL_API +# endif #endif /** pointer to a malloc function, supporting client overriding memory -- cgit v1.2.1