title: How to use C++ allocated array in Emscripten generated code?
body: <p>I have a C++ code like this:</p>
  
  <pre><code>extern "C" {
  
  void MyCoolFunction (int** values)
  {
      int howManyValuesNeeded = 5;
      *values = new int[howManyValuesNeeded];
      for (int i = 0; i &lt; howManyValuesNeeded; i++) {
          (*values)[i] = i;
      }
  }
  
  }
  </code></pre>
  
  <p>From C++ it can be used like this:</p>
  
  <pre><code>int *values = NULL;
  MyCoolFunction (&amp;values);
  // do something with the values
  delete[] values;
  </code></pre>
  
  <p>Of course the real code is much more complicated, but the point is that the function allocates an int array inside, and it decides what the array size will be.</p>
  
  <p>I translated this code with Emscripten, but I don't know how could I access the array allocated inside the function from javascript. (I already know how to use exported functions and pointer parameters with Emscripten generated code, but I don't know how to solve this problem.)</p>
  
  <p>Any ideas?</p>