title: C# struct to C++ Marshalling problem
body: <p>I'm invoking a C++ function from within C#.</p>
  
  <p>This is the function header in C++ : </p>
  
  <pre><code>int src_simple (SRC_DATA *data, int converter_type, int channels) ;
  </code></pre>
  
  <p>And this is the equivilent C# function :</p>
  
  <pre><code>[DllImport("libsamplerate-0.dll")]
      public static extern int src_simple(ref SRC_DATA sd, int converter_type, int channels);
  </code></pre>
  
  <p>This is the SRC_DATA structure in C++ and then in C# : </p>
  
  <pre><code> typedef struct
    {   float  *data_in, *data_out ;
  
        long   input_frames, output_frames ;
        long   input_frames_used, output_frames_gen ;
  
        int    end_of_input ;
  
        double src_ratio ;
    } SRC_DATA ;
  </code></pre>
  
  <p>This is the C# struct I have defined :</p>
  
  <pre><code>[StructLayout(LayoutKind.Sequential, Pack = 1)]
  public struct SRC_DATA
  {
  
      public IntPtr data_in, data_out;
  
      public long input_frames, output_frames;
      public long input_frames_used, output_frames_gen;
  
      public int end_of_input;
      public double src_ratio;
  
  }
  </code></pre>
  
  <p>The big problem is that the last parameter , src_ratio, doesn't get delivered properly to the C++ function, (it sees it as 0 or something invalid). </p>
  
  <p>Are my declarations correct?</p>
  
  <p>Thanks</p>