-static if (is(typeof(VirtualAlloc)))
-{
- /**
- * Map memory.
- */
- void *os_mem_map(size_t nbytes)
- {
- return VirtualAlloc(null, nbytes, MEM_RESERVE, PAGE_READWRITE);
- }
-
-
- /**
- * Commit memory.
- * Returns:
- * 0 success
- * !=0 failure
- */
- int os_mem_commit(void *base, size_t offset, size_t nbytes)
- { void *p;
-
- p = VirtualAlloc(base + offset, nbytes, MEM_COMMIT, PAGE_READWRITE);
- return cast(int)(p is null);
- }