I am trying to pass a structure from C# into C++ library. I pass structure as an object, and C++ function expects it as a pointer (void *).
I am having problem pas
Try passing the structure as a ref parameter.
[DllImport("MockVadavLib.dll", CharSet = CharSet.Ansi)] public static extern IntPtr TheFunction(ref UserRec userRec);
When you use a ref combined with a structure, it conceptually passes the address.