Replies: 1 comment 2 replies
-
Define failed? I tried your code and everything is working as I expect. The cmake_minimum_required(VERSION 3.23.1)
project(rtti-test CXX)
add_library(native SHARED native.cpp)
target_compile_options(native PRIVATE -fno-rtti)
add_executable(app app.cpp)
target_compile_options(app PRIVATE -frtti)
target_link_libraries(app PRIVATE native) Built with $ cmake -DCMAKE_TOOLCHAIN_FILE=~/Library/Android/sdk/ndk/24.0.8215888/build/cmake/android.toolchain.cmake -DANDROID_STL=c++_shared -DANDROID_ABI=arm64-v8a ..
$ make
adb shell "LD_LIBRARY_PATH=/data/local/tmp /data/local/tmp/app"
catch exception: User defined runtime error in app |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have an executable
app
compiled with-frtti
, and a shared librarylibnative.so
compiled with-fno-rtti
.STL: c++_shared
ndk: r21
The executable and library are built via ndk CMake.
In
app
code, throwstd::runtime_error
and try catchstd::exception
, it always failed.Example:
app.cpp
libnative.cpp
Beta Was this translation helpful? Give feedback.
All reactions