Avoid clashing with system headers when redefining standard library functions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
diff --git a/src/hidapi/windows/hid.c b/src/hidapi/windows/hid.c
index f0a30c7..8dfd11d 100644
--- a/src/hidapi/windows/hid.c
+++ b/src/hidapi/windows/hid.c
@@ -43,21 +43,6 @@
typedef LONG NTSTATUS;
#endif
-/* SDL C runtime functions */
-#include "SDL_stdinc.h"
-
-#define calloc SDL_calloc
-#define free SDL_free
-#define malloc SDL_malloc
-#define memcpy SDL_memcpy
-#define memset SDL_memset
-#define strcmp SDL_strcmp
-#define strlen SDL_strlen
-#define strstr SDL_strstr
-#define strtol SDL_strtol
-#define wcscmp SDL_wcscmp
-#define _wcsdup SDL_wcsdup
-
/* The maximum number of characters that can be passed into the
HidD_Get*String() functions without it failing.*/
#define MAX_STRING_WCHARS 0xFFF
@@ -94,11 +79,26 @@ extern "C" {
} /* extern "C" */
#endif
+#include "../hidapi/hidapi.h"
+
/*#include <stdio.h>*/
/*#include <stdlib.h>*/
+/* SDL C runtime functions */
+#include "SDL_stdinc.h"
+
+#define calloc SDL_calloc
+#define free SDL_free
+#define malloc SDL_malloc
+#define memcpy SDL_memcpy
+#define memset SDL_memset
+#define strcmp SDL_strcmp
+#define strlen SDL_strlen
+#define strstr SDL_strstr
+#define strtol SDL_strtol
+#define wcscmp SDL_wcscmp
+#define _wcsdup SDL_wcsdup
-#include "../hidapi/hidapi.h"
#undef MIN
#define MIN(x,y) ((x) < (y)? (x): (y))