Commit eb6b5eb2666475372e945af4552918f3fd993148
1 parent
12316f7d
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
Showing
1 changed file
with
7 additions
and
0 deletions
build/android/app/src/main/cpp/main.cpp
| ... | ... | @@ -217,10 +217,17 @@ void android_main(struct android_app* state) |
| 217 | 217 | dlerror(); /* Clear any existing error */ |
| 218 | 218 | |
| 219 | 219 | int (*main)(int, char**) = (int (*)(int, char**))dlsym(handle, "main"); |
| 220 | + LOGV("lib=%s handle=%p main=%p", libpath.c_str(), handle, main ); | |
| 220 | 221 | if(main) |
| 221 | 222 | { |
| 222 | 223 | status = main(0, nullptr); |
| 223 | 224 | } |
| 225 | + else | |
| 226 | + { | |
| 227 | + LOGE("lib %s doesn't have main()", libpath.c_str()); | |
| 228 | + status = EFAULT; | |
| 229 | + std::exit(status); | |
| 230 | + } | |
| 224 | 231 | |
| 225 | 232 | if(handle) |
| 226 | 233 | { | ... | ... |