I have an native C++ library which makes use of a large static buffer (it acquires data from a device).
Let s say this buffer is defined like this:
unsigned char LargeBuffer[1000000];
Now I would like to expose parts of this buffer to managed C++, e.g. when 1000 bytes of new data are stored by the library at LargeBuffer[5000]
I would like to perform a callback into managed C++ code, passing a pointer to LargeBuffer[5000]
so that managed C++ can access the 1000 bytes of data there (directly if possibile, i.e. without copying data, to achieve maximum performance).
What is the best way to let managed C++ code access data in this native array?