I have a C# application.I need to pass a object say a of class A to a function in cpp.The cpp code is compiled to a dll file.
I need to dllimport and pass the object from c# to cpp where cpp changes the data members of this object and these changes need to be reflected in C#.
The class I need to pass to cpp function also contain objects of some other classes.
C#
[DllImport("My.d ll", EntryPoint = "TestFn", ExactSpelling = false)]
public static extern void TestFn(ref A a);
calling in c#
TestFn(ref a);
Rightnow I am getting this exception :
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
I need to dllimport and pass the object from c# to cpp where cpp changes the data members of this object and these changes need to be reflected in C#.
The class I need to pass to cpp function also contain objects of some other classes.
C#
[DllImport("My.d ll", EntryPoint = "TestFn", ExactSpelling = false)]
public static extern void TestFn(ref A a);
calling in c#
TestFn(ref a);
Rightnow I am getting this exception :
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Comment