On Tue, Feb 09, 2021 at 09:37:12AM +0100, Martin Liška wrote:
> PING^2
> 
> @Honza: ?

Just concerning Windows (though I don't have access to that OS and can't
verify), e.g.
https://github.com/m-labs/uclibc-lm32/blob/master/utils/mmap-windows.c
contains public domain code to emulate mmap on top of the Windows APIs.
Guess it could be simplified (we only need anonymous memory and don't need a
mmap emulation, can just call).
#include <io.h>
#include <windows.h>

  HANDLE h = CreateFileMapping (INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE,
                                0, size, NULL);
  void *mem = NULL;
  if (h)
    mem = MapViewOfFile (h, FILE_MAP_WRITE, 0, 0, size);

...
// When done:
  if (mem)
    UnmapViewOfFile (mem);
  if (h)
    CloseHandle (h);

Perhaps ask somebody with access to Windows to verify?

        Jakub

Reply via email to