In c++ API Declaration is
BOOL DCAMAPI dcam_attachbuffer ( HDCAM h, void** top, _DWORD size );
arguments :
void** top— is the array of pointer to buffer
_DWORD size– is size of top parameter in bytes
In c#, this is how I import the dll file:
[DllImport("dcamapi.dll", EntryPoint = "dcam_attachbuffer",
CallingConvention = CallingConvention.StdCall,
CharSet = CharSet.Ansi, BestFitMapping = false,
ThrowOnUnmappableChar = true)]
[return: MarshalAsAttribute(UnmanagedType.Bool)]
public static extern bool dcam_attachbuffer(IntPtr handleCamera,
[MarshalAsAttribute(UnmanagedType.LPArray)]ref Int32[] buf,
[MarshalAsAttribute(UnmanagedType.U4)] Int32 bufsize);
My question is do I convert the type from c++ into c# correctly? and How do I declare void**in c#? please help me.
It is depending on what function dcam_attachbuffer do.
If it’s taking buffer, define method
and pass pointer derived earlier.
If function is getting pointer of pointers, define method
and use
to copy pointers in IntPtr[]