1// At the dll wrapper class
2[DllImport(path, EntryPoint = "?GetParameters@@YGHKPAU_DevParam@@@Z")]
3public static extern bool GetParameters(int ID, IntPtr dParam);
4
5// At main
6int size = Marshal.SizeOf(typeof(DevParam));
7IntPtr Ptr = Marshal.AllocHGlobal(size);
8bool res = Class1.GetParameters(ID, Ptr);
9DevParam test = (DevParam)Marshal.PtrToStructure(Ptr, typeof(DevParam));
10
11// For testing purpoises, previously changed the default values with another method
12Console.WriteLine(test.Enable);
13
14Marshal.FreeHGlobal(Ptr);