Error message when demo lib doesn't have main() 10/245910/1
authorCheng-Shiun Tsai <cheng.tsai@samsung.com>
Mon, 19 Oct 2020 14:29:49 +0000 (15:29 +0100)
committerCheng-Shiun Tsai <cheng.tsai@samsung.com>
Mon, 19 Oct 2020 14:29:49 +0000 (15:29 +0100)
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

index d02bb12..7b1d624 100644 (file)
@@ -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)
   {