title: Android - native global object destructor never called
body: <p>I load a shared library, with the classic System.loadLibrary() method, from a static java block. The library has global object allocated statically:</p>
  
  <pre><code>class Foo
  {
  public:
     Foo()
     {
     }
  
     ~Foo()
     {
        logtofile( "Foo::~Foo() called" );
     }
  }
  
  
  Foo dummy;
  </code></pre>
  
  <p>The global function logtofile writes a log file on the sdcard. While the constructor gets called when the library is loaded, it seems to me that the destructor is never called. I expected that between two constructors calls there should be a destructor call. So the question is: when the Foo destructor gets called?</p>