How to pass structure as pointer in C dll from C#
<p>I am working on simple telephony application where I am changing the class of service of panasonic pbx extension. For that I am using "Tapi32.dll" which has methods in c++. Now as per my need I have to pass two argument both integer pointer type. One Argument is getting passed correctly but I am not able to pass second argumnet which is structure type. </p>

<p>Here is my code...</p>

<pre><code>[DllImport("Tapi32.dll", CharSet=CharSet.Auto, SetLastError=true)]
unsafe private static extern int lineDevSpecific(int* hLine, int* lpParams);

[StructLayout(LayoutKind.Sequential)]
public struct UserRec {
    [MarshalAs(UnmanagedType.I4)]
    public int dwMode=4;
    public int dwParam1=8;
}

unsafe static void Main(string[] args) {
    int vline=int.Parse("Ext101");
    int* hline = &amp;vline;
    lineDevSpecific(hline, ref UserRec userrec);
}
</code></pre>
