title: Problem in passing arrays from C# to C++
body: <p>I have an application in which I need to pass an array from C# to a C++ DLL. What is the best method to do it? I did some search on Internet and figured out that I need to pass the arrays from C# using ref. The code for the same:</p>
  
  <pre><code>status = IterateCL(ref input, ref output);
  </code></pre>
  
  <p>The input and output arrays are of length 20. and the corresponding code in C++ DLL is </p>
  
  <pre><code>IterateCL(int *&amp;inArray, int *&amp;outArray)
  </code></pre>
  
  <p>This works fine for once. But if I try to call the function from C# in a loop the second time, the input array in C# is showing up as an array of one element. Why is this happening and please help me how I can call this function iteratively from C#.</p>
  
  <p>Thanks,
  Rakesh.</p>