Tanmay Sarkar

Tanmay Sarkar

  • NA
  • 1.5k
  • 1m

managed pinvoke signature does not match

Aug 18 2010 2:09 PM
I write a simple c++ dll & when i am call it in 3.5 frame work it works fine.
The call is like that.....

[DllImport("MyDll.dll")]
        public static extern int add(int a, int b);


        private void button1_Click(object sender, EventArgs e)
        {
            int x = 5, y = 9;
            int z = add(x, y);
            MessageBox.Show(Convert.ToString(z));
        }
it works fine no doubt. (return 14)

But when I put this code in framework 4 it gets an error.
the error is ->

"..... the managed pinvoke signature does not match the unmanaged target signature ....."

Please help me, what i do to overcome this problem in Framework 4.

Thank you in advance!


Answers (3)