I'm encountering issues when trying to compile my C code on Win64. More specifically, the compiler cannot find the sys/mman.h
header, which I understand is found in Unix environments only.
I already know this is deals with memory allocation.
Is there an equivalent for Windows I can use in order to port the code (first time trying)?
Code in that causes issues:
/* Allocate memory required by processes */
buf = (int*) malloc (sizeof(int));
if (!buf)
{
perror("Error");
free (buf);
return -3;
}
/* Lock down pages mapped to processes */
puts("Locking down processes.");
if(mlockall (MCL_CURRENT | MCL_FUTURE) < 0)
{
perror("mlockall");
free (buf);
return -4;
}
You should look at the mman-win32 library. But as @Mgetz pointed out, a more simple way is to look at the VirtualAllocEx
functions and try to adapt your code.