c#
using System;
using System.Runtime.InteropServices;
public class Tester
{
[DllImport("test.so", EntryPoint="process_3d_array")]
public static extern uint test(IntPtr grid, int width, int length, int height );
public static int height = 20 ,width = 20 , length = 5;
public static short[,,] testArr = new short[height,width,length];
public static void Main(string[] args)
{
try
{
unsafe
{
fixed (short* pArray = testArr)
{
IntPtr arr = (IntPtr)pArray;
test(arr, width, length, height);
}
}
}
catch (Exception ex)
{
Console.WriteLine("Exception occurred: " + ex.Message);
}
for(int i = 0 ; i < length ;i++){
for(int j = 0 ; j < width ; j++){
Console.Write(testArr[0,i,j]);
}
Console.WriteLine();
}
}
}
c#
using System;
using System.Runtime.InteropServices;
public class Tester
{
[DllImport("test.so", EntryPoint="process_3d_array")]
public static extern uint test(IntPtr grid, int width, int length, int height );
public static int height = 20 ,width = 20 , length = 5;
public static short[,,] testArr = new short[height,width,length];
public static void Main(string[] args)
{
try
{
unsafe
{
fixed (short* pArray = testArr)
{
IntPtr arr = (IntPtr)pArray;
test(arr, width, length, height);
}
}
}
catch (Exception ex)
{
Console.WriteLine("Exception occurred: " + ex.Message);
}
for(int i = 0 ; i < length ;i++){
for(int j = 0 ; j < width ; j++){
Console.Write(testArr[0,i,j]);
}
Console.WriteLine();
}
}
}