C# Programming
07-03-2010, 02:00 PM
Hello,
I am using GCHandle to allow unmanaged code to access some managed data.
My code is as follows:
byte[] data = new byte[numBytes];
GCHandle dataPtr = GCHandle.Alloc(data, GCHandleType.Pinned);
Now what I would like to do is to be able to address with an offset into my dataPtr array. So, I need to get the address of an element (say element number 100) and pass that to my unmanaged C++ code. I see some method to convert it ToIntPtr(). However, does anyone know what might be the best way to address the offset?
Many thanks,
keith
I am using GCHandle to allow unmanaged code to access some managed data.
My code is as follows:
byte[] data = new byte[numBytes];
GCHandle dataPtr = GCHandle.Alloc(data, GCHandleType.Pinned);
Now what I would like to do is to be able to address with an offset into my dataPtr array. So, I need to get the address of an element (say element number 100) and pass that to my unmanaged C++ code. I see some method to convert it ToIntPtr(). However, does anyone know what might be the best way to address the offset?
Many thanks,
keith