提交 5b4b82c4 authored 作者: Mike Jerris's avatar Mike Jerris

working windows build

上级 9830fb63
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
/* These warnings need to be ignored warning in sdk header */ /* These warnings need to be ignored warning in sdk header */
#include <Ws2tcpip.h> #include <Ws2tcpip.h>
#include <windows.h> #include <windows.h>
#pragma comment(lib, "Ws2_32.lib")
#ifndef errno #ifndef errno
#define errno WSAGetLastError() #define errno WSAGetLastError()
#endif #endif
......
...@@ -37,7 +37,15 @@ ...@@ -37,7 +37,15 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.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> #include <unistd.h>
#endif #endif
#include <sys/mman.h> #include <sys/mman.h>
...@@ -66,6 +74,18 @@ static unsigned int min_bit_free_next = 0; /* min size of next pnt */ ...@@ -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 int min_bit_free_size = 0; /* min size of next + size */
static unsigned long bit_array[MAX_BITS + 1]; /* size -> bit */ 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 ******************************/ /****************************** local utilities ******************************/
/* /*
......
...@@ -57,6 +57,9 @@ ...@@ -57,6 +57,9 @@
#if defined(_MSC_VER) || defined(__MINGW32__) #if defined(_MSC_VER) || defined(__MINGW32__)
/* provide gettimeofday() missing in Windows */ /* provide gettimeofday() missing in Windows */
#ifdef _MSC_VER
#pragma comment(lib, "Winmm.lib")
#endif
int gettimeofday(struct timeval *tp, void *tzp) { int gettimeofday(struct timeval *tp, void *tzp) {
DWORD t; DWORD t;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论