title: Android: Is there just once instance of a HAL module?
body: <p>I am confused about the lifetime and usage of HAL modules.  Traditionally, a HAL module is implemented as a set of hooks to various functions and is compiled into a shared library.  Suppose I have two applications that link to <code>libhardware</code> and both call <code>hw_get_module()</code> somewhere in their code.    </p>
  
  <pre><code>struct my_audio_stream {
      struct audio_stream base;      /* base HAL */
      int count;
  }
  
  struct audio_module HAL_MODULE_INFO_SYM = {
      .base = 
          .common = {
             .tag = HARDWARE_MODULE_TAG,
             .module_api_version = AUDIO_MODULE_API_VERSION_0_1,
             .hal_api_version = HARDWARE_HAL_API_VERSION,
             .id = AUDIO_HARDWARE_MODULE_ID,
             .name = "USB audio HW HAL",
             .author = "The Android Open Source Project",
             .methods = &amp;hal_module_methods,
          },
  }
  </code></pre>
  
  <p>If I increment the count variable in one application, will it be visible to the other application?  I.e, is there just one global instance of the <code>my_audio_stream</code> module?</p>