You will need to define a delegate and mark it up with UnmanagedFunctionPointer
e.g. something like
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
public delegate void FPS_PositionCallback(
Int32 devNo,
Int32 length,
Int32 index,
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)]double[] positions,
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)]double[] markers);
I am assuming that bln32 is a double, but you may also need CDecl
instead of StdCall
and Int16
instead of Int32
.
you can then pass this to your c-function e.g. something that might be declared like this
[DllImport("FPSLIB.dll")]
public static extern void setPositionCallback([MarshalAs(UnmanagedType.FunctionPtr)] FPS_PositionCallback callbackPointer);
then execute e.g.
FPS_PositionCallback callback =
(devNo, length, index, positions, markers) =>
{
};
setPositionCallback(callback);
You will probably have a lot of fiddling to do to get it exactly right.