title: Initializing global variables to zero on Android NDK
body: <p>I'm developing an app using plain C and the latest Android NDK. I noticed that the *.so is never flushed from memory and so the global variables retain their values from the last run of the app, e.g. consider the following code:</p>
  
  <pre><code>static int init = 0;
  
  void android_main(struct android_app* state)
  {
    init = 1;
    dostuff();
  }
  </code></pre>
  
  <p>When my app is launched for the first time, "init" is 0 and set to 1. Starting with the second run, "init" will always be 1 because the *.so is still in memory. But I want the globals to be reset to their default value whenever android_main() is called!</p>
  
  <p>So is there any way to ensure that the globals are always reset before android_main() is called or do I have to do this manually? (which would be a huge work for my app because I'm having tons of globals spread across different *.c sources)</p>
  
  <p>Thanks!</p>