public int pull_chunk(string[,] data_buffer, double[] timestamp_buffer, double timeout) { int ec = 0; IntPtr[,] tmp = new IntPtr[data_buffer.GetLength(0),data_buffer.GetLength(1)]; uint res = dll.lsl_pull_chunk_str(obj, tmp, timestamp_buffer, (uint)tmp.Length, (uint)timestamp_buffer.Length, timeout, ref ec); check_error(ec); try { for (int s = 0; s < tmp.GetLength(0); s++) for (int c = 0; c < tmp.GetLength(1); c++) data_buffer[s,c] = Marshal.PtrToStringAnsi(tmp[s,c]); } finally { for (int s = 0; s < tmp.GetLength(0); s++) for (int c = 0; c < tmp.GetLength(1); c++) dll.lsl_destroy_string(tmp[s,c]); } return (int)res / data_buffer.GetLength(1); }