I am trying to develop a COM object using C++ and ATL to be used by both C++ and C# Windows Mobile clients. The COM object wraps up all of the logic to connect to our server and send/receive data using our proprietary protocol. I am having some difficulty coming up with an OnReceive event that works correctly with C# and C++.
I have defined the event function like this:
HRESULT OnReceive(BYTE* pBuffer, LONG lSize);
But when I look at the function in C# or Object Browser, it comes out as:
OnReceive(ref byte pBuffer, int lSize);
How would I treat "ref byte" as a pointer in C#? How can I pass binary data to OnReceive and allow both C++ and C# clients to access the binary data?