Passing a vector/array from unmanaged C++ to C#
As long as the managed code does not resize the vector, you can access the buffer and pass it as a pointer with vector.data() (for C++0x) or &vector[0]. This results in a zero-copy system. Example C++ API: #define EXPORT extern “C” __declspec(dllexport) typedef intptr_t ItemListHandle; EXPORT bool GenerateItems(ItemListHandle* hItems, double** itemsFound, int* itemCount) { auto … Read more