calling a c++ code from C# in x64 all arguments shift by one
问题 my c++ dll: int test2::CallMe(int y) { return y; } c# code: [DllImport("test2.dll",CharSet = CharSet.Anci)] private static extern int CallMe(int y); Console.WriteLine(CallMe(7)); if the dll and the test program are compiled in x86 i get a print: 7 but if i compile them at X64 for c++ and X64 or any CPU for c# the print is: 0 Any suggestion? edit: the problem is the call, because in debugger i see that the CPP receives 0 , or null in case of struct. edit 2: the functions are exported using a