hello stack,
this is really strange, i have an array in delphi and fill it with directX matrices. then i get the pointer to the first element and pass it via com to c# managed code:
function TMPlugTransformInPin.GetMatrixPointer(out SliceCount: Integer; out
ValueP: Int64): HResult;
var
matrices: array of TD3DMatrix;
i: Integer;
begin
SliceCount := UserSliceCount;
//make a temp array of all matrices
SetLength(matrices, SliceCount);
for i := 0 to SliceCount - 1 do
matrices[i] := FTransformManager.ModelMatrix[i];
//return a pointer to the first matrices cell [0,0]
if SliceCount = 0 then
ValueP := 0
else
ValueP := Int64(@matrices[0]);
Result := S_OK;
end;
on managed side the code looks like this:
if (IsChanged)
{
int sliceCount;
long source;
FTransformIn.GetMatrixPointer(out sliceCount, out source);
SliceCount = sliceCount;
System.Diagnostics.Debug.WriteLine(source);
if (FSliceCount > 0)
Marshal.Copy(new IntPtr(source), FData, 0, FData.Length);
}
this all works for an array size up to 4136 (66176 floats), but for higher counts, the pointer to the array gets invalid..
any ideas?
thanks a lot! thalm