title: Use SWIG to Handle C Function Returning A Pointer to Array of Structure in Java
body: <p>I'm trying to figure out what SWIG Interface file change is needed in order to handle the getFoo returns a pointer that points to an array of a custom structure (sender_id_t).  Without any special SWIG Interface code, I get just the pointer on the Java side.  How can I turn that pointer into something I can loop or iterate over (in Java) so that I can get each sender_id_t id value?  Appreciate any suggestions.  </p>
  
  <p>C Structure:</p>
  
  <pre><code>typedef unsigned char id_v1_t[32];
  typedef id_v1_t id_t;
  %rename (Sample) sender_id_t_;
  struct sender_id_t_ {
      id_t       id;
      uint32_t   phy_idx;
  };
  </code></pre>
  
  <p>C Function:</p>
  
  <pre><code>//This will return a pointer to an array of sender_id_t data.  The number of elements is retrieved from a separate call. 
  sender_id_t* getFoo(resultset_t* resultset);
  </code></pre>
  
  <p>Exception:</p>
  
  <pre><code> [exec] test_wrap.c: In function `new_foo_array':
   [exec] test_wrap.c:785: error: invalid application of `sizeof' to incomplete type `sender_id_t_' 
   [exec] test_wrap.c: At top level:
   [exec] test_wrap.c:792: error: return type is an incomplete type
   [exec] test_wrap.c: In function `foo_array_getitem':
   [exec] test_wrap.c:793: error: invalid use of undefined type `struct sender_id_t_'
   [exec] test_wrap.c:793: error: dereferencing pointer to incomplete type
   [exec] test_wrap.c:793: warning: `return' with a value, in function returning void
   [exec] test_wrap.c: At top level:
   [exec] test_wrap.c:795: error: parameter `value' has incomplete type
   [exec] test_wrap.c: In function `foo_array_setitem':
  </code></pre>