Dear All,
I have a problem with calling a dll which writed by C++
Code:
 private void read_Click(object sender, EventArgs e)
        {
            if (OpenCom(3) > 0)
                MessageBox.Show("COM 3 is opened");
            else
                MessageBox.Show("Error");


                int[] data = new int[128];
                string text1 = "";


                if (readVW(2, 100, 1, data[0]) > 0)//<-- here is an exception occur,readVW is a method in a dll file,I have used dllimport to import it
                {
                    for (int i = 0; i < 6; i++)
                    {
                        text1 = text1 + data[i] + ",";
                        VWread.Text = text1;

                    }
                }

                else
                {
                    text1 = "Error1";
                    VWread.Text = text1;
                }
            }
When I run it, an error message"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
What is the problem of it?Thanks