C++ 返回值的调用问题

2025-03-21 02:52:13
推荐回答(1个)
回答1:

懒得写桩函数去调试,就先凭感觉乱写一点。思路能看懂就好

using system.runtime.interopservices;
DatabaseResult r = xxxxxxxxx
string[][] rows = new string[rowcount][columncount];
IntPtr[] pRows = new IntPtr[rowcount];
marshal.copy(r.rows, pRows, 0, rowcount);
IntPtr[] pCols = new IntPtr[columncount];
for(int i = 0; i < rowcount; ++i) {
marshal.copy(pRows[i], pCols, 0, columncount);
for(int j = 0; j < columncount; ++j) {
rows[i][j] = marshal.ptrtostringansi(pCols[j]);
}
}
这样可以么?