I import a C++ dll into a C# project and, on a x64 machine, on debug mode, PInvoke complains that m开发者_运维问答anaged signature does not match the unmanaged target signature.
C++:
void _Foo(signed long int x);
C#:
[DllImport("foo.dll", EntryPoint="_Foo"]
public static extern void Foo(int x)
Replacing int
in the C# code with IntPtr
or Int64
didn't solve the problem.
Any suggestions?
It's System.Int32. Also known as "int".
A long int
in C++ == int
in C#. Both are 4 bytes long. A long long
in C++ == long
in C#. (8 bytes).
As Larry above says, if it is picking up a type mismatch, it is not because of the int.
精彩评论