Exit not return

While our application has successfully linked with the Android system libraries of libc.so and libandroid_runtime.so and can actually run, there are missing pieces that cause the application to not properly execute. When we build an application in this manner, without letting the linker do all of its magic of knitting the entire application together, we have to do some housekeeping ourselves. Looks like there was something to that 500 KB application after all!

For one thing, if our application's entry point is the main function, and the main function executes a return statement, just where does it return to? Let's replace the return statement with an exit() call, as shown in listing 13.5.

0 0

Post a comment