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

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -