From eb6b5eb2666475372e945af4552918f3fd993148 Mon Sep 17 00:00:00 2001 From: Cheng-Shiun Tsai Date: Mon, 19 Oct 2020 15:29:49 +0100 Subject: [PATCH] Error message when demo lib doesn't have main() Demos like deferred-shading.example sometimes fail to launch due to libdeferred-shading.example.so doesn't have main() When such error happens, output error to logcat Change-Id: Iecec465cf2436ff04a78ac78bd4c6fee0282ac3d --- build/android/app/src/main/cpp/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/build/android/app/src/main/cpp/main.cpp b/build/android/app/src/main/cpp/main.cpp index d02bb12..7b1d624 100644 --- a/build/android/app/src/main/cpp/main.cpp +++ b/build/android/app/src/main/cpp/main.cpp @@ -217,10 +217,17 @@ void android_main(struct android_app* state) dlerror(); /* Clear any existing error */ int (*main)(int, char**) = (int (*)(int, char**))dlsym(handle, "main"); + LOGV("lib=%s handle=%p main=%p", libpath.c_str(), handle, main ); if(main) { status = main(0, nullptr); } + else + { + LOGE("lib %s doesn't have main()", libpath.c_str()); + status = EFAULT; + std::exit(status); + } if(handle) { -- 2.7.4