CWB
Functions

windows-mmap.c File Reference

This file provides an equivalent of the POSIX mmap() function for use in Windows; the Windows API lacks this function. More...

#include "windows-mmap.h"

Functions


Detailed Description

This file provides an equivalent of the POSIX mmap() function for use in Windows; the Windows API lacks this function.

The code was adapted from the Git project (note that Git is GPL-licensed).

Very important note: this file should only be compiled and linked when targeting a windows environment.


Function Documentation

void* mmap ( void *  start,
size_t  length,
int  prot,
int  flags,
int  fd,
off_t  offset 
)

Substitute POSIX mmap() for use in Windows.

It wraps the Windows API functions CreateFileMapping() and MapViewOfFileEx().

The arguments, return, etc. are the same as POSIX mmap(), which is documented much more thoroughly than we could hope to do here.

References MAP_FAILED, and MAP_PRIVATE.

Referenced by mmapfile().

int munmap ( void *  start,
size_t  length 
)

Substitute POSIX munmap() for environments that lack it.

It wraps the Windows API function UnmapViewOfFile().

See also:
mmap

Referenced by mfree().