Skip to content

Commit

Permalink
Introduce export map to completely hide private symbols
Browse files Browse the repository at this point in the history
Also put configureModelCacheSize into the rlottie namespace.
  • Loading branch information
mymedia2 authored and smohantty committed Sep 30, 2019
1 parent 0bfae1d commit ad10004
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down
8 changes: 8 additions & 0 deletions rlottie.expmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/* This version script for ld exposes only (r)lottie namespace. */
{
global:
lottie_*;
extern "C++" { rlottie::* };
local:
*;
};
2 changes: 1 addition & 1 deletion src/lottie/lottieanimation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
6 changes: 6 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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',
)

Expand Down

0 comments on commit ad10004

Please sign in to comment.