title: returning an array from C to Java with SWIG
body: <p>I have a C function like this:</p>
  
  <pre><code>void get_data(const obj_t *obj, short const **data, int *data_len);
  </code></pre>
  
  <p>I wrote it like this specifically for Swig, since </p>
  
  <pre><code>const short *get_data(const obj_t *obj, int *data_len);
  </code></pre>
  
  <p>causes trouble, as SWIG's typemaps aren't smart enough to associate the data_len with the return value.</p>
  
  <p>In Java I want to be able to call this function like this:</p>
  
  <pre><code>short data[]= mylib.get_data(obj);
  </code></pre>
  
  <p>But I can't figure out how to get the array output parameter to become a return value.  With Ruby and Python this works fine, as SWIG for those languages supports returning output params as return values (since the languages can have multiple return values).</p>
  
  <p>How can I get this to work with Java?</p>