title: how to properly pass a float pointer from a C library to its C# wrapper
body: <p>I have a function in my custom C library which returns a pointer to a float. (This is actually an array of floats which contains audio values).</p>
  
  <p>I want to use this C library (and returned float array) in Unity3d so I am writing a C# wrapper for it. How do I properly import/declare my C function in my c# script?</p>
  
  <p>my C declarations looks like this:</p>
  
  <pre><code>float*  getAudioBuffer(mySynth_t synth);
  </code></pre>
  
  <p>In C# my guess is that I should declared my imported function as returning float[] like this:</p>
  
  <pre><code>[DllImport (dll)]
  private static extern float[]  getAudioBuffer(  IntPtr synth)
  </code></pre>
  
  <p>Is that correct?
  Shall I use <code>ref</code> keyword? Shall I use <code>out</code> keyword somewhere?
  I familiar with C++ but bot at all with C# so I do not really understand mashalling etc. </p>
  
  <p>Also the data in the float array are audio data to fill Unity3d's audio buffer in OnFilterRead. So this will be called many times. 
  Any hint, sample code, or pointer on best practices would be appreciated.</p>