public static List <Data> GetDataByArray() { var resultList = new List <Data>(); IntPtr data; int count; NativeLib.GetDataByArray(out data, out count); var pos = new IntPtr(data.ToInt64()); for (int i = 0; i < count; i++) { resultList.Add(Data.PtrToThis(pos)); pos = IntPtr.Add(pos, Marshal.SizeOf <Data>()); Console.WriteLine($"{resultList.Last<Data>().info} - {resultList.Last<Data>().subInfo} - { resultList.Last<Data>().messageStr}");; } return(resultList); }
public static List <Data> GetData() { var resultList = new List <Data>(); // Get structure list from C++ IntPtr data; NativeLib.GetData(out data); // Add in List at C# if (data != IntPtr.Zero) { var currentData = Data.PtrToThis(data); do { Console.WriteLine($"{currentData.info} - {currentData.subInfo} - {currentData.messageStr}"); resultList.Add(currentData); currentData = currentData.GetNext; } while (currentData != null); resultList.Remove(null); } return(resultList); }
public static int Add(int a, int b) { return(NativeLib.add(a, b)); }
public static void Clean() { NativeLib.Cleanup(); }