A
Andreas Reiff
Hi!
I want some communication to take place between a c++ app and a c++ .dll
with an intermediate managed/unmanaged c++ dll. Basicall, I want the
unmanaged c++ dll to have a callback to the unmanaged c++ app. Also, the
managed c++ part should call the c# dll. I don't mind about where the array
is created, but I need to be able to pass it around.
Anyhow, my problem is, that if I create an array in unmanaged c++ like
double **a;
a = new double*[10];
for (int i = 0; i < 10; i++)
a = new double[100];
I cannot pass it into c# (since I call this function via a delegate, which
right now requires a paramter like InArray (see below)?!).
So my code in managed c++ look like this
array<Object ^> ^ InArray = gcnew array<Object ^>(numberOfArrays);
for (int i = 0; i < numberOfArrays; i++)
InArray = gcnew array<double>(numberOfElements);
But this code again I cannot pass back into unmanaged c++.
When I try to pin_ptr each element of the array, I have the problem, that I
need a new pin_ptr for each element of the first dimension of the array, but
the array can actually be of any size, and anyhow, I would not want to have
10 lines of code just to pin_ptr all 10 1-dimensional arrays in the 2-dim
array.
Hope this is not too confusing?!
Best regards,
Andreas
I want some communication to take place between a c++ app and a c++ .dll
with an intermediate managed/unmanaged c++ dll. Basicall, I want the
unmanaged c++ dll to have a callback to the unmanaged c++ app. Also, the
managed c++ part should call the c# dll. I don't mind about where the array
is created, but I need to be able to pass it around.
Anyhow, my problem is, that if I create an array in unmanaged c++ like
double **a;
a = new double*[10];
for (int i = 0; i < 10; i++)
a = new double[100];
I cannot pass it into c# (since I call this function via a delegate, which
right now requires a paramter like InArray (see below)?!).
So my code in managed c++ look like this
array<Object ^> ^ InArray = gcnew array<Object ^>(numberOfArrays);
for (int i = 0; i < numberOfArrays; i++)
InArray = gcnew array<double>(numberOfElements);
But this code again I cannot pass back into unmanaged c++.
When I try to pin_ptr each element of the array, I have the problem, that I
need a new pin_ptr for each element of the first dimension of the array, but
the array can actually be of any size, and anyhow, I would not want to have
10 lines of code just to pin_ptr all 10 1-dimensional arrays in the 2-dim
array.
Hope this is not too confusing?!
Best regards,
Andreas