Jon Harrop wrote:
Does .NET provide an equivalent of memory mapped files from Linux?
Win32 API does.
I once used it Delphi-C#.
Below is a snippet of declarations.
Arne
================================================== ==========
const int PAGE_READONLY = 0x0002;
const int PAGE_READWRITE = 0x0004;
const int PAGE_EXECUTE = 0x0010;
const int PAGE_EXECUTE_READ = 0x0020;
const int PAGE_EXECUTE_READWRITE = 0x0040;
const int PAGE_GUARD = 0x0100;
const int PAGE_NOACCESS = 0x0001;
const int PAGE_NOCACHE = 0x0200;
const int FILE_MAP_COPY = 0x0001;
const int FILE_MAP_WRITE = 0x0002;
const int FILE_MAP_READ = 0x0004;
const int FILE_MAP_ALL_ACCESS = 0x001F;
[StructLayout( LayoutKind.Sequential )]
class SECURITY_ATTRIBUTES
{
//int nLength;
//int lpSecurityDescriptor;
//int bInheritHandle;
}
[DllImport("kernel32.dll")]
static extern int CreateFileMappingA ( uint hFile,
SECURITY_ATTRIBUTES
lpFileMappigAttributes,
int flProtect,
int dwMaximumSizeHigh,
int dwMaximumSizeLow,
string lpName);
[DllImport("kernel32.dll")]
static extern IntPtr MapViewOfFile ( int hFileMappingObject,
int dwDesiredAccess,
int dwFileOffsetHigh,
int dwFileOffsetLow,
int dwNumberOfBytesToMap);
[DllImport("kernel32.dll")]
static extern int UnmapViewOfFile (IntPtr lpBaseAddress);
[DllImport("kernel32.dll")]
static extern int CloseHandle ( int hObject);