I have written this code but still can't find the function. Please help me rectify the problem.
The code:-
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- Test t = new Test();
- IntPtr fooPtr = Test.plus(5, 7);
- int LENGTH = 0;
- var foo = new int[LENGTH];
- Marshal.Copy(fooPtr, foo, 0, LENGTH);
- MessageBox.Show(LENGTH.ToString());
- }
- }
- internal sealed class Test
- {
- [DllImport("F://test_Multiple//MFCApplication2//Debug//MFCApplication2.exe", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
- public static extern IntPtr plus(int a, int b);
- }