I'm writing a win32 dll for read/write USB HID device. The data for exchange is a 64 byte unsigned char array. The client program is written in C++/CLI.
In order to achieve max speed and minimum overhead, I need an efficient way to sending the array to managed client.
There are two options I can think of right now:
Native: use PostMessage and send the pointer for the array.
Managed: in WndProc, Marshal.Copy the pointer to a new managed Byte array, then delete the pointer.Native: use function pointer as a callback to process the data.
Managed: use Marshal.GetFunctionPointerForDelegate to pass function pointer to native world.
Thanks.