"apm" <Co*********@AdsorptionProcessModeling.com> wrote in message
news:RBQ6f.5995$vS1.1384@dukeread03...
Is there a way to go from a pointer to an unmanaged array of double to a
managed Array of Double without having to copy the values? The unmanaged
code calls back into managed code. The unmanaged callback arguments
include arrays of double. The delegate used to define the callback
function requires managed arguments.
The caller wants
void __cdecl func(double* x)
It actually needs to call
_delegate void func(Double x[])
You need to allocate the array in managed code in the first place, then you
can get a double __in* pointing into the managed array that can be passed to
your native code.
If the array must be allocated by native code, there's no way to reflect it
into the managed world as an array without copying the values, AFIAK
(although I do recall reading discussion of possibly adding such a facility
to the CLR, I don't think it was ever done).
-cd