Hi people
I am wrapping a C dll using PInvoke from C#. I need to wrap the following signature in C
int dma_start( const UCHAR* data, UINT data_length )
The function should start with a DMA operation, and I have to use it from my C# program. I am really unsure what type of marshalling I should use.
The data parameter is a pointer to an array of byte data. This data must not be copied when calling the function. Plus, the .NET framework should not move the data around in memory until the method returns. Currently, I've made the interop signature as follows
[DllImport("UsedLib.dll", EntryPoint="dma_start")
[return : MarshalAs(UnmanagedType.I4)
public static extern bool DMAStart (
[MarshalAs(UnmanagedType.U1)] ref byte DMAData
[MarshalAs(UnmanagedType.U4)] uint DMALength
)
Is this a good way to define the pointer to the array (DMAData)
How do I say to the .NET framework that it shouldn't move the byte data around in memory, until the method returns
Thanks a lot
--
Tom Tempelaere.