justinstenning / SharedMemory

C# shared memory classes for sharing data between processes (Array, Buffer and Circular Buffer)
https://www.nuget.org/packages/SharedMemory
Other
566 stars 118 forks source link

SharedMemory in Unity3D #37

Closed nowakpe closed 5 years ago

nowakpe commented 5 years ago

I just tried examples from here in Unity and I had an exception when using CircularBuffer.

_EntryPointNotFoundException: mono_win32_compatCopyMemory

CircularBuffer is somewhere using CopyMemoryPtr method ([DllImport("kernel32.dll", EntryPoint = "CopyMemory", SetLastError = false)])

What helped me to fix this error: change EntryPoint = "CopyMemory" for EntryPoint = "RtlCopyMemory"

TechnikEmpire commented 5 years ago

That's a kernel-mode function. Check the charset declaration and linkage specifiers of your pinvoke methods.

justinstenning commented 5 years ago

This looks to be a Mono specific issue. Using RtlCopyMemory fails otherwise.