I am trying to expose a Managed Function to Unmanaged Code using C++/CLI wrapper
public:array<double, 3>^ CallingBrownianManagedCodeTemp()
{
int numPaths = 100;
int dimension = 3;
double time = 30;
int seed = 1;
double stepSize = 1.0 / 12.0;
int scrambling = 0;
array<double, 2>^ covMatrix = { { 1.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }, { 0.0, 0.0, 1.0 } };
std::string str = "Sobol";
String^ newSystemString = gcnew String(str.c_str());
array<double, 3>^ result = (array<double, 3>^) IAModel::RandomNumberGenerator::iBrownianBridge(numPaths, dimension, time, seed, covMatrix, stepSize, newSystemString, scrambling);
return result;
}
__declspec(dllexport) void CallBrownianManagedAdapter(double*** myArray)
{
BrownianWrapper::BrownianBridgeAdapter objectBrownian;
array<double, 3>^ brownianArray = objectBrownian.CallingBrownianManagedCodeTemp();
}
I need to copy the contents of brownianArray (Managed Array Dynamic) to Unmanaged array which is myarray. I do not mind vector also. I was trying to declare a vector but the program won't recognize the vector in CLI.
I am new to C++, appreciate any suggestion
What I have tried:
stackoverflow.
It works in C#