diff --git a/CMakeLists.txt b/CMakeLists.txt index 6697a157..1dd5175e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,8 @@ project(labview-grpc C CXX) if(NOT MSVC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") + # Set default visibility to hidden, only export LIBRARY_EXPORT symbols from the shared library + add_compile_options(-fvisibility=hidden) else() add_definitions(-D_WIN32_WINNT=0x600) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") diff --git a/src/lv_interop.h b/src/lv_interop.h index 846fad06..07c2c81c 100644 --- a/src/lv_interop.h +++ b/src/lv_interop.h @@ -20,7 +20,7 @@ #ifdef _WIN32 #define LIBRARY_EXPORT extern "C" __declspec(dllexport) #else - #define LIBRARY_EXPORT extern "C" + #define LIBRARY_EXPORT extern "C" __attribute__((visibility("default"))) #endif namespace grpc_labview