Check out example codes for "c# p/involke c++ dll get struct". It will help you in understanding the concepts better.

Code Example 1

// At the dll wrapper class
[DllImport(path, EntryPoint = "[email protected]@[email protected]@@Z")]
public static extern bool GetParameters(int ID, IntPtr dParam);

// At main
int size = Marshal.SizeOf(typeof(DevParam));
IntPtr Ptr = Marshal.AllocHGlobal(size);
bool res = Class1.GetParameters(ID, Ptr);
DevParam test = (DevParam)Marshal.PtrToStructure(Ptr, typeof(DevParam));

// For testing purpoises, previously changed the default values with another method
Console.WriteLine(test.Enable);

Marshal.FreeHGlobal(Ptr);

Learn ReactJs, React Native from akashmittal.com