working windows build

This commit is contained in:
Mike Jerris 2015-09-04 13:25:13 -04:00
parent 9830fb63f6
commit 5b4b82c4f0
3 changed files with 25 additions and 1 deletions

View File

@ -59,6 +59,7 @@
/* These warnings need to be ignored warning in sdk header */
#include <Ws2tcpip.h>
#include <windows.h>
#pragma comment(lib, "Ws2_32.lib")
#ifndef errno
#define errno WSAGetLastError()
#endif

View File

@ -37,7 +37,15 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef _MSC_VER
#ifdef _MSC_VER
#include <io.h>
#ifndef open
#define open _open
#endif
#ifndef close
#define close _close
#endif
#else
#include <unistd.h>
#endif
#include <sys/mman.h>
@ -66,6 +74,18 @@ static unsigned int min_bit_free_next = 0; /* min size of next pnt */
static unsigned int min_bit_free_size = 0; /* min size of next + size */
static unsigned long bit_array[MAX_BITS + 1]; /* size -> bit */
#ifdef _MSC_VER
#include <Windows.h>
long getpagesize(void) {
static long g_pagesize = 0;
if (!g_pagesize) {
SYSTEM_INFO system_info;
GetSystemInfo(&system_info);
g_pagesize = system_info.dwPageSize;
}
return g_pagesize;
}
#endif
/****************************** local utilities ******************************/
/*

View File

@ -57,6 +57,9 @@
#if defined(_MSC_VER) || defined(__MINGW32__)
/* provide gettimeofday() missing in Windows */
#ifdef _MSC_VER
#pragma comment(lib, "Winmm.lib")
#endif
int gettimeofday(struct timeval *tp, void *tzp) {
DWORD t;