[.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

相關文章
相關標籤/搜索