A
azerty
Hello
I want to create a fonction in DLL C to change value in an array of Point
come from C# world ...
I do this sample fonction in C witch return sum of (X+Y) af all items in an
Array of Point and change the value of its ...
int GetPoints5(int length, POINT* points)
{
int result = 0;
for (int i = 0; i < length; i++ )
{
result += points->x;
result += points->y;
points->x++;
points->y++;
points++;
}
return result;
}
in C# world, i do this :
[DllImport("DllENC")]
private extern static int GetPoints5(int length, Point[] points);
.....
Point[] points = new Point[int.Parse(textBox3.Text)];
for (int i = 0; i < points.Length; i++ )
{
points.X = 1;
points.Y = 2;
}
button6.Text = GetPoints5(int.Parse(textBox3.Text), points).ToString();
listBox1.DataSource = points;
.....
GetPoints5 return the good sum !!!! but points array is not modify !!! Its
seem Point pass to C function by value and not by ref ....
someone can may help me !!
thanks a lot for your help !!!
I want to create a fonction in DLL C to change value in an array of Point
come from C# world ...
I do this sample fonction in C witch return sum of (X+Y) af all items in an
Array of Point and change the value of its ...
int GetPoints5(int length, POINT* points)
{
int result = 0;
for (int i = 0; i < length; i++ )
{
result += points->x;
result += points->y;
points->x++;
points->y++;
points++;
}
return result;
}
in C# world, i do this :
[DllImport("DllENC")]
private extern static int GetPoints5(int length, Point[] points);
.....
Point[] points = new Point[int.Parse(textBox3.Text)];
for (int i = 0; i < points.Length; i++ )
{
points.X = 1;
points.Y = 2;
}
button6.Text = GetPoints5(int.Parse(textBox3.Text), points).ToString();
listBox1.DataSource = points;
.....
GetPoints5 return the good sum !!!! but points array is not modify !!! Its
seem Point pass to C function by value and not by ref ....
someone can may help me !!
thanks a lot for your help !!!