title: Returning C arrays into python scope from scipy's weave.inline
body: <p>I am using scipy's weave.inline to perform computationally expensive tasks. I have problems returning an one-dimensional array back into the python scope. Weave.inline uses a special argument called "return_val" for the purpose of returning values back into the python scope.
  The following example returning an integer value works well:</p>
  
  <pre><code>&gt;&gt;&gt; from scipy.weave import inline
  &gt;&gt;&gt; print inline(r'''int N = 10; return_val = N;''')
  10
  </code></pre>
  
  <p>However the following example, which indeed compiles without prompting an error, does not return the array i would expect:</p>
  
  <pre><code>&gt;&gt;&gt; from scipy.weave import inline
  &gt;&gt;&gt; code =\
      r'''                                                              
         int* pairs;                                                       
         int  lenght = 0;                                                      
         for (int i=0;i&lt;N;i++){                                            
           lenght   += 1;                                                     
           pairs     = (int *)malloc(sizeof(int)*lenght);                       
           pairs[i]  = i;
           std::cout &lt;&lt; pairs[i] &lt;&lt; std::endl;              
         }                                                                 
         return_val = pairs;                                               
      '''
   &gt;&gt;&gt; N  = 5
   &gt;&gt;&gt; R = inline(code,['N'])
   &gt;&gt;&gt; print "RETURN_VAL:",R
   0
   1
   2
   3
   4
   RETURN_VAL: 1    
  </code></pre>
  
  <p>I need to reallocate the size of the array "pairs" dynamically which is why I can't pass a numpy.array or python list per se.</p>