c# - How to copy a array of unmanaged memory into the same unmanaged memory -


i reserved memory 10 items of 128 bytes

intptr dst = marshal.allochglobal (10 * 128);  intptr src1 = marshal.allochglobal (128); // .... init scr1 dll intptr src2 = marshal.allochglobal (128); // .... init scr2 dll 

i need copy 128 bytes elements of src1 , src2 dst @ specified offset.

marshal.copy not suitable such purposes. since src , dst in unmanaged memory area.

the window's api function memcopy should trick.

[dllimport("msvcrt.dll", entrypoint = "memcpy",     callingconvention = callingconvention.cdecl,      setlasterror = false)] public static extern intptr memcpy(intptr dest, intptr src, uintptr count); 

also, check out:

https://stackoverflow.com/a/2658394/558018

as claims, can use unsafe context manually transfer necessary bytes.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -