Introduce export map to completely hide private symbols
authorNicholas Guriev <guriev-ns@ya.ru>
Fri, 27 Sep 2019 18:28:05 +0000 (21:28 +0300)
committerJongmin Lee <jm105.lee@samsung.com>
Tue, 1 Oct 2019 21:30:59 +0000 (06:30 +0900)
Also put configureModelCacheSize into the rlottie namespace.

CMakeLists.txt
rlottie.expmap [new file with mode: 0644]
src/lottie/lottieanimation.cpp
src/meson.build

index e0d4e0b..74a7536 100644 (file)
@@ -68,6 +68,13 @@ target_link_libraries(rlottie
                         "${CMAKE_THREAD_LIBS_INIT}"
                      )
 
+if (NOT APPLE AND NOT WIN32)
+    target_link_libraries(rlottie
+                        PRIVATE
+                            "-Wl,--version-script=${CMAKE_SOURCE_DIR}/rlottie.expmap"
+                          )
+endif()
+
 if (LOTTIE_MODULE)
     # for dlopen, dlsym and dlclose dependancy
     target_link_libraries(rlottie PRIVATE ${CMAKE_DL_LIBS})
diff --git a/rlottie.expmap b/rlottie.expmap
new file mode 100644 (file)
index 0000000..cfc3828
--- /dev/null
@@ -0,0 +1,8 @@
+/* This version script for ld exposes only (r)lottie namespace. */
+{
+global:
+    lottie_*;
+    extern "C++" { rlottie::* };
+local:
+    *;
+};
index be4d93e..caf546d 100644 (file)
@@ -25,7 +25,7 @@
 
 using namespace rlottie;
 
-LOT_EXPORT void configureModelCacheSize(size_t cacheSize)
+LOT_EXPORT void rlottie::configureModelCacheSize(size_t cacheSize)
 {
     LottieLoader::configureModelCacheSize(cacheSize);
 }
index 3bcd609..da62e2d 100644 (file)
@@ -7,6 +7,11 @@ if (cc.get_id() != 'msvc')
                        '-Woverloaded-virtual', '-Wno-unused-parameter']
 endif
 
+linker_flags = []
+if (host_machine.system() not in ['darwin', 'windows'])
+    linker_flags += ['-Wl,--version-script=@0@/../rlottie.expmap'.format(meson.current_source_dir())]
+endif
+
 subdir('vector')
 subdir('lottie')
 subdir('binding')
@@ -19,6 +24,7 @@ rlottie_lib = library('rlottie',
                       dependencies          : rlottie_lib_dep,
                       install               : true,
                       cpp_args              : compiler_flags,
+                      link_args             : linker_flags,
                       gnu_symbol_visibility : 'hidden',
                      )