Hide all symbols that are not explicitly exported in release builds

This commit is contained in:
Johannes Schriewer 2018-08-05 18:45:16 +02:00
parent fffcd3500d
commit 61f0bc880e
2 changed files with 6 additions and 2 deletions

View file

@ -21,7 +21,7 @@ configure_file (
#
if (UNIX)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wall -Wextra -Wno-unused-parameter -fprofile-arcs -ftest-coverage -O0 -pthread -DDEBUG=1")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wall -Wno-unused-parameter -Os -pthread")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Wall -Wno-unused-parameter -fvisibility=hidden -fvisibility-inlines-hidden -Os -pthread")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-lgcov")
endif() # UNIX

View file

@ -21,7 +21,11 @@ extern "C" {
#if MSVC
#define API __declspec(dllexport)
#else
#define API
#if DEBUG
#define API __attribute__((visibility("visible")))
#else
#define API __attribute__((visibility("visible")))
#endif
#endif
#include <stdint.h>