diff -ru pari-2.3.5.orig\src\gp\highlvl.c pari-2.3.5\src\gp\highlvl.c
--- pari-2.3.5.orig\src\gp\highlvl.c    Thu Feb 04 11:55:42 2010
+++ pari-2.3.5\src\gp\highlvl.c Wed Mar 03 12:28:18 2010
@@ -18,6 +18,13 @@
 /*        SOME GP FUNCTION THAT MAY BE USEFUL OUTSIDE OF IT        */
 /*                                                                 */
 /*******************************************************************/
+
+/* we need to include windows.h quite early to avoid some macro name collisions */
+#ifdef _WIN32
+#  define WIN32_LEAN_AND_MEAN
+#  include <windows.h>
+#endif
+
 #include "pari.h"
 #include "paripriv.h"
 #include "../graph/rect.h"
--- ./src/language/es.c.orig	2008-03-31 04:43:58.000000000 -0700
+++ ./src/language/es.c	2018-07-29 00:36:28.971866700 -0700
@@ -2836,6 +2836,10 @@ os_read(long fd, char ch[], long s)
 #endif
 }
 
+#ifdef HAS_OPENDIR
+#  include <dirent.h>
+#endif
+
 long
 os_open(char *s, int mode)
 {
@@ -2872,7 +2876,6 @@ static char *last_filename = NULL;
 
 #ifdef HAS_OPENDIR
 /* slow, but more portable than stat + S_I[FS]DIR */
-#  include <dirent.h>
 static int
 is_dir_opendir(char *name)
 {