hxcpp
hxcpp copied to clipboard
Add an option to disable static link to libc++ on Android/Clang
Currently, in android-toolchain-clang.xml
, flag -static-libstdc++
is used.
However, when using multiple shared libraries, it is recommended to link with libc++ dynamically (and embed libc++_shared.so in final apk) because multiple shared libraries with static link to libc++ can lead to undefined behavior. See this for reference: https://developer.android.com/ndk/guides/cpp-support
I understand that as long as we use a single .so in the final app, static link is easier, but there should be an option to disable it, like HXCPP_LIBCPP_SHARED
or similar, that removes -static-libstdc++
flag from the toolchain and make it default to shared libc++. (or make -static-libstdc++
flag require HXCPP_LIBCPP_STATIC
, that would work too).
(also note that I can do a pull request with the described change if needed! 🙂)