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!
Loading

Tanmay SarkarPosted Sep 1, 2010, 1:45 PM
that problem can really make any body to crazy, while it well work in framework 3.5 but not work in 4.
Welcome to this forum, enjoy it.
Thank You! :)
hatake kakashiPosted Sep 1, 2010, 4:53 AM
Thank you very much for your own answer to your problem :D. I have the same problem as yours, and it has driven me crazy for a whole day.
I register an account at this forum just to say thank you :)
Best regards,
Kakashi
Tanmay SarkarPosted Aug 18, 2010, 9:15 PM
[DllImport("MyDll.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int add(int a,int b);
this is work in framework 4.
And now there is no exception. It well work now.
Thank you!