diff options
author | John Stamp <jstamp@users.sourceforge.net> | 2010-07-28 15:36:33 -0700 |
---|---|---|
committer | Lloyd Hilaiel <lloyd@hilaiel.com> | 2010-08-10 11:54:25 -0600 |
commit | 0915ba9cb5b469e3d186227ebbecdae6c259d0c2 (patch) | |
tree | 0459026f5eb3577580e4a266d9234db67ef00b09 | |
parent | 8a6bb359a240b4e651ba260ab7719821695974f4 (diff) | |
download | yajl-0915ba9cb5b469e3d186227ebbecdae6c259d0c2.tar.gz |
Don't export private symbols
Signed-off-by: Lloyd Hilaiel <lloyd@hilaiel.com>
-rw-r--r-- | CMakeLists.txt | 7 | ||||
-rw-r--r-- | src/api/yajl_common.h | 6 |
2 files changed, 12 insertions, 1 deletions
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 |