我想從C#代碼中訪問這個C++函數在我的計劃問題導入C++ DLL
Tridiagonal3 (float** mat, float* diag, float* subd)
{
float a = mat[0][0], b = mat[0][1], c = mat[0][2],
d = mat[1][1], e = mat[1][2],
f = mat[2][2];
}
是如下圖所示
tred2(tensor, eigenValues, eigenVectors);
其中張量float[,]
和特徵值的呼叫和特徵向量是float[]
陣列。
當我嘗試這樣做,我得到一個異常
Access violation reading location 0x3f5dce99
,當我嘗試訪問
float a = mat[0][0]
可能是什麼回事?
您作爲參數傳入了什麼內容?它看起來像數組尚未分配。 – DanDan 2011-05-17 16:07:47
你爲什麼不發佈呼叫站點代碼?順便說一句'float [,]'是什麼? – Nawaz 2011-05-17 16:09:25
@Nawaz:'float [,]'是C#中的一個多維數組。 – 2011-05-17 16:10:48