summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2014-10-16 18:59:40 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2014-10-16 19:58:17 -0400
commit6828f17265878e40b40e2992c1791a0c6806ff8c (patch)
tree8baee85e7218dbad9725fcc8743baf4833298cb8 /examples
parent185694d3494ce6817cd854feaff7169fb41dd13d (diff)
downloadmongo-6828f17265878e40b40e2992c1791a0c6806ff8c.tar.gz
Port all examples, most tests, and wtperf to Windows
Added windows_shim to emulate most functions
Diffstat (limited to 'examples')
-rw-r--r--examples/c/ex_all.c5
-rw-r--r--examples/c/ex_async.c6
-rw-r--r--examples/c/ex_extending.c4
-rw-r--r--examples/c/ex_log.c5
-rw-r--r--examples/c/ex_scope.c5
-rw-r--r--examples/c/ex_thread.c6
6 files changed, 31 insertions, 0 deletions
diff --git a/examples/c/ex_all.c b/examples/c/ex_all.c
index 32850a59385..d4f571ccaf6 100644
--- a/examples/c/ex_all.c
+++ b/examples/c/ex_all.c
@@ -38,7 +38,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+
+#ifndef _WIN32
#include <unistd.h>
+#else
+#include "windows_shim.h"
+#endif
#include <sys/stat.h>
#include <wiredtiger.h>
diff --git a/examples/c/ex_async.c b/examples/c/ex_async.c
index fb3c77e9a6d..0c8f83e4aac 100644
--- a/examples/c/ex_async.c
+++ b/examples/c/ex_async.c
@@ -31,12 +31,18 @@
#include <inttypes.h>
#include <stdio.h>
#include <string.h>
+#ifndef _WIN32
#include <unistd.h>
+#else
+#include "windows_shim.h"
+#endif
#include <wiredtiger.h>
#if defined(_lint)
#define ATOMIC_ADD(v, val) ((v) += (val), (v))
+#elif defined(_WIN32)
+#define ATOMIC_ADD(v, val) (_InterlockedExchangeAdd(&(v), val) + val)
#else
#define ATOMIC_ADD(v, val) __sync_add_and_fetch(&(v), val)
#endif
diff --git a/examples/c/ex_extending.c b/examples/c/ex_extending.c
index 62abaa09bf8..f043dd5b383 100644
--- a/examples/c/ex_extending.c
+++ b/examples/c/ex_extending.c
@@ -35,6 +35,10 @@
#include <wiredtiger.h>
+#ifdef _WIN32
+#define strcasecmp stricmp
+#endif
+
static const char *home;
/*! [case insensitive comparator] */
diff --git a/examples/c/ex_log.c b/examples/c/ex_log.c
index 27e8e810252..8ac7d079da1 100644
--- a/examples/c/ex_log.c
+++ b/examples/c/ex_log.c
@@ -31,7 +31,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#ifndef _WIN32
#include <unistd.h>
+#else
+/* snprintf is not supported on <= VS2013 */
+#define snprintf _snprintf
+#endif
#include <wiredtiger.h>
diff --git a/examples/c/ex_scope.c b/examples/c/ex_scope.c
index 8dea4cfc772..334745f7e37 100644
--- a/examples/c/ex_scope.c
+++ b/examples/c/ex_scope.c
@@ -34,6 +34,11 @@
#include <wiredtiger.h>
+#ifdef _WIN32
+/* snprintf is not supported on <= VS2013 */
+#define snprintf _snprintf
+#endif
+
static const char *home;
static int
diff --git a/examples/c/ex_thread.c b/examples/c/ex_thread.c
index 05a1fc96d15..256449aa3dc 100644
--- a/examples/c/ex_thread.c
+++ b/examples/c/ex_thread.c
@@ -29,11 +29,17 @@
* table from multiple threads.
*/
+#ifndef _WIN32
#include <pthread.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#ifdef _WIN32
+#include "windows_shim.h"
+#endif
+
#include <wiredtiger.h>
static const char *home;