我有一块.NET code,我想移植到64位。在codeS基本上是一组的P / Invoke的调用其他的C DLL。其中一个在C DLL中的函数具有参数为size_t。我应该在P用什么数据类型/调用签名,以便编组工作正常。我想用的IntPtr或UIntPtr,但有人说,他们是在.NET中的指针等同的事情,不应该使用它。有谁知道什么是正确的类型,这是?
I have a piece of .NET code which I want to port to 64-bit. The codes basically is a set of P/Invoke calls to some other C dll. One of the functions in the C dll has a parameter 'size_t'. What datatype should I use in my P/Invoke signature so that the marshalling works fine. I was thinking of using a IntPtr or a UIntPtr but some say that they are a pointer equivalent thing in .NET and shouldnt be using it. Does anyone know what the correct type for this is?
UIntPtr将工作(IntPtr的可能会工作过,但为size_t是无符号的,所以UIntPtr是一个更好的配合)
UIntPtr will work (IntPtr would probably work too, but size_t is unsigned, so UIntPtr is a better fit)
JaredPar写在他的博客东西(和follow-up)关于这一点。
JaredPar has written something on his blog (and a follow-up) about this.
上一篇:确定正版Windows安装在C#安装在、Windows
下一篇:是否有一个选项"去行"在的TextReader / StreamReader的?有一个、选项、QUOT、TextReader