In my solution I have C++/CLI (vs2012) project that executes some method in C++ (vs2010) project. Here is a signature of native code:
void Pcl::Downsample(std::vector<CloudPointNative>& points, std::vector<std::vector<int>>& clusters)
And here is how I execute it on C++/CLI side:
std::vector<std::vector<int>> clusters;
pcl->Downsample(points, clusters);
Then I try to iterate over clusters:
for (int clusterIndex = 0; clusterIndex < clusters.size(); clusterIndex++)
{
auto cluster = clusters[clusterIndex];
The size of clusters is 7 and each item in the vector contains vectors of int. I can see this in debugger on the native side. As soon as I get back to managed side (C++/cli project) I get problems. It works correctly if clusterIndex == 0 and clusterIndex == 5. But throws AccessViolationException on any other values of clusterIndex.
auto cluster0 = clusters[0]; // works
auto cluster1 = clusters[1]; // AccessViolationException
auto cluster5 = clusters[5]; // works
How can this be?
Downsampleand calling it in the same DLL? - pogorskiy