title: passing structure reference from a c# code to call a c++ DLL function that accept structure reference in its prototype
body: <p>I hav a function in c++ DLL that has following prototype</p>
  
  <p><code>int function(RefPar &amp;params);</code></p>
  
  <p>how can i call this function from a c# program using "DLLImport".</p>
  
  <p>when i tried like below, <code>AccessViolationException</code> happened while running in visual studio 2008..</p>
  
  <pre><code>[DllImport("VistaGMMDLL.dll", EntryPoint = "function"]
  unsafe static extern int function(ref RefPar params);
  </code></pre>
  
  <p>and called as.. </p>
  
  <pre><code>int ret=function(ref params);
  </code></pre>
  
  <blockquote>
    <p><strong>Note</strong>:RefPar structure has many
    unsigned integer values and 1 enum
    value as its members.</p>
  </blockquote>
  
  <p>pls anyone help me to call the function correctly..</p>