From 7f93def03000cb2795ddd7a7d6f8e2ef296030b6 Mon Sep 17 00:00:00 2001 From: tensor-tang Date: Mon, 9 Jul 2018 22:37:26 +0800 Subject: [PATCH] inference api static lib symbol hidden --- paddle/contrib/inference/CMakeLists.txt | 4 ++++ paddle/contrib/inference/paddle_inference_api.sym | 1 + 2 files changed, 5 insertions(+) create mode 100644 paddle/contrib/inference/paddle_inference_api.sym diff --git a/paddle/contrib/inference/CMakeLists.txt b/paddle/contrib/inference/CMakeLists.txt index c30eff501..17bf9c983 100644 --- a/paddle/contrib/inference/CMakeLists.txt +++ b/paddle/contrib/inference/CMakeLists.txt @@ -45,6 +45,10 @@ endfunction(inference_api_test) cc_library(paddle_inference_api SRCS paddle_inference_api.cc paddle_inference_api_impl.cc DEPS ${FLUID_CORE_MODULES} ${GLOB_OP_LIB}) +if(NOT APPLE) + set(LINK_FLAGS "-Wl,--retain-symbols-file ${CMAKE_CURRENT_SOURCE_DIR}/paddle_inference_api.sym") + set_target_properties(paddle_inference_api PROPERTIES LINK_FLAGS "${LINK_FLAGS}") +endif() # Here the shared library doesn't depend on other fluid libraries, or double free will occur. cc_library(paddle_inference_api_shared SHARED diff --git a/paddle/contrib/inference/paddle_inference_api.sym b/paddle/contrib/inference/paddle_inference_api.sym new file mode 100644 index 000000000..ef2a04d78 --- /dev/null +++ b/paddle/contrib/inference/paddle_inference_api.sym @@ -0,0 +1 @@ +*paddle* -- GitLab