diff --git a/CMakeLists.txt b/CMakeLists.txt index 36283a7..7807873 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/src/mqtt.h.in b/src/mqtt.h.in index 08d54ad..e58e444 100644 --- a/src/mqtt.h.in +++ b/src/mqtt.h.in @@ -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