title: Copying content of C buffer to numpy array
body: <p>I have a function in C like this:</p>
  
  <p>source file</p>
  
  <pre><code>// foo.cpp
  int foo(int input1, double *output1, int size1, int* output2, int size2)
  {
  // does stuff and allocate space for output1 and output2
      return 0;
  }
  </code></pre>
  
  <p>header file</p>
  
  <pre><code>// foo.h
  int foo(int input1, double *output1, int size1, int* output2, int size2);
  </code></pre>
  
  <p>In Cython I need to convert <code>output1</code> and <code>output2</code> to a numpy array, so in my <code>foo.pyx</code> I do the following steps:</p>
  
  <pre><code>cdef extern from "foo.h":
      cdef int foo(int input1, double* output1, int size1, double* output2, int size2) 
  
  cdef double* ptnOutput1
  cdef int* ptnOutput2
  
  foo(1, ptnOutput1, 10, ptnOutput2, 10)
  </code></pre>
  
  <p>but now I'm not able to get the output in form of two <code>np.array</code>. How should I align the pointers <code>ptnOutput1</code> and <code>ptnOutput2</code> to two numpy arrays?
  I've tried <code>np.frombuffer</code> as well as <code>np.PyArray_SimpleNewFromData</code> but with no luck. I always get segmentation fault.
  Any idea how to do it correctly?</p>