I have a C # structure to represent a Cartesian vector, something like this:
public struct Vector
{
private double x;
private double y;
private double z;
}
Now I have an unmanaged C dll that I need to call using P / Invoke. Some methods expect a double parameter [3].
Unmanaged C Signature is similar to
void Cross(double a[3], double b[3], double c[3]);
Is there a way to customize the P / Invoke signature so that I can pass instances of my Vector structure and marshal them transparently to an unmanageable double [3]? I will also need bidirectional marshaling, since an unmanaged function should write the output to an array of arguments, so I think I would need to marshal as LpArray.
Pedro source
share