[.Net 5.0] 4.非托管内存数据复制

[DllImport("kernel32.dll")]
        private static extern void CopyMemory(IntPtr Destination, IntPtr Source, int Length);

原来一直用CopyMemory,.Net5.0说找不到入口点了code

[DllImport("msvcrt.dll", EntryPoint = "memcpy", CallingConvention = CallingConvention.Cdecl, SetLastError = false)]
        private static extern IntPtr memcpy(IntPtr dest, IntPtr src, int count);

还好 memcpy仍是支持的。不知因此然...io

搜了一下,还就是入口点没写对ast

[DllImport("kernel32.dll", EntryPoint = "RtlMoveMemory", CharSet = CharSet.Ansi)]

这样就OK了。static