Example C API signature:
void Func(unsigned char* bytes);
In C, when I want to pass a pointer to an array, I can do:
unsigned char* bytes = new unsigned char[1000]; Func(bytes); // call
How do I translate the above API to P/Invoke such that I can pass a pointer to C# byte array?
The easiest way to pass an array of bytes is to declare the parameter in your import statement as a byte array.
You should also be able to declare the parameter as an IntPtr and Marshal the data manually.