Appel Dll C++ et pointeur C#
Bonjour,
J'aimerais passer des pointeurs en paramètre à ma dll.
Voici le code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
[DllImport(@"MaDLL.dll")]
private static unsafe extern void ProduitScalaire(float* va, float* vb, float* vc);
public static Vector ProduitScalaire_Vector(Vector v1, Vector v2)
{
Vector _out = new Vector();
float[] tab_v1 = new float[3];
tab_v1[0] = (float)v1.x;
tab_v1[1] = (float)v1.y;
tab_v1[2] = (float)v1.z;
float[] tab_v2 = new float[3];
tab_v2[0] = (float)v2.x;
tab_v2[1] = (float)v2.y;
tab_v2[2] = (float)v2.z;
float[] tab_v3 = new float[3];
// Ce que je veux :
// ProduitScalaire(pointeur sur tab_v1, pointeur sur tab_v2, pointeur sur tab_v3)
} |
Comment puis-je faire ?
Je galère vraiment sur la gestion des pointeurs en C#
Merci d'avance.
PS : La dll est compiler en C++