diff --git a/src/bignum.h b/src/bignum.h
index 885f839c0b1acaa24fc8da8b8f82ad454c6aad4b..966d0923a8b97b2ce988806426dacae97dd1aa21 100644
--- a/src/bignum.h
+++ b/src/bignum.h
@@ -35,76 +35,76 @@ extern "C++" {
  *  The family of DO_*_OVERFLOW functions sets the result only if no overflow occured.
  */
 #define GENERIC_OVERFLOW_CHECKS(type)                                                   \
-static INLINE int __attribute__((unused)) DO_## type ## _NEG_OVERFLOW(type a, type * res) { \
+static INLINE int ATTRIBUTE((unused)) DO_## type ## _NEG_OVERFLOW(type a, type * res) { \
     if (a == MIN_ ## type) return 1;                                                    \
     *res = -a;                                                                          \
     return 0;                                                                           \
 }                                                                                       \
-static INLINE int __attribute__((unused)) type ## _NEG_OVERFLOW(type a) {                                       \
+static INLINE int ATTRIBUTE((unused)) type ## _NEG_OVERFLOW(type a) {                                       \
     return a == MIN_ ## type;                                                           \
 }                                                                                       \
-static INLINE int __attribute__((unused)) type ## _DIV_OVERFLOW(type a, type b) {                               \
+static INLINE int ATTRIBUTE((unused)) type ## _DIV_OVERFLOW(type a, type b) {                               \
     return a == MIN_ ## type && b == -1;                                                \
 }                                                                                       \
-static INLINE int __attribute__((unused)) DO_ ## type ## _DIV_OVERFLOW(type a, type b, type * res) {            \
+static INLINE int ATTRIBUTE((unused)) DO_ ## type ## _DIV_OVERFLOW(type a, type b, type * res) {            \
     if (a == MIN_ ## type && b == -1) return 1;                                         \
     *res = a/b;                                                                         \
     return 0;                                                                           \
 }                                                                                       \
-static INLINE int __attribute__((unused)) U ## type ## _MUL_OVERFLOW(unsigned type a, unsigned type b) {        \
+static INLINE int ATTRIBUTE((unused)) U ## type ## _MUL_OVERFLOW(unsigned type a, unsigned type b) {        \
     unsigned type res;                                                                  \
     return DO_U ## type ## _MUL_OVERFLOW(a, b, &res);                                   \
 }                                                                                       \
-static INLINE int __attribute__((unused)) U ## type ## _ADD_OVERFLOW(unsigned type a, unsigned type b) {        \
+static INLINE int ATTRIBUTE((unused)) U ## type ## _ADD_OVERFLOW(unsigned type a, unsigned type b) {        \
     unsigned type res;                                                                  \
     return DO_U ## type ## _ADD_OVERFLOW(a, b, &res);                                   \
 }                                                                                       \
-static INLINE int __attribute__((unused)) U ## type ## _SUB_OVERFLOW(unsigned type a, unsigned type b) {        \
+static INLINE int ATTRIBUTE((unused)) U ## type ## _SUB_OVERFLOW(unsigned type a, unsigned type b) {        \
     unsigned type res;                                                                  \
     return DO_U ## type ## _SUB_OVERFLOW(a, b, &res);                                   \
 }                                                                                       \
-static INLINE int __attribute__((unused)) type ## _MUL_OVERFLOW(type a, type b) {                               \
+static INLINE int ATTRIBUTE((unused)) type ## _MUL_OVERFLOW(type a, type b) {                               \
     type res;                                                                           \
     return DO_ ## type ## _MUL_OVERFLOW(a, b, &res);                                    \
 }                                                                                       \
-static INLINE int __attribute__((unused)) type ## _ADD_OVERFLOW(type a, type b) {                               \
+static INLINE int ATTRIBUTE((unused)) type ## _ADD_OVERFLOW(type a, type b) {                               \
     type res;                                                                           \
     return DO_ ## type ## _ADD_OVERFLOW(a, b, &res);                                    \
 }                                                                                       \
-static INLINE int __attribute__((unused)) type ## _SUB_OVERFLOW(type a, type b) {                               \
+static INLINE int ATTRIBUTE((unused)) type ## _SUB_OVERFLOW(type a, type b) {                               \
     type res;                                                                           \
     return DO_ ## type ## _SUB_OVERFLOW(a, b, &res);                                    \
 }                                                                                       \
-static INLINE int __attribute__((unused)) type ## _MOD_OVERFLOW(type a, type b) {                               \
+static INLINE int ATTRIBUTE((unused)) type ## _MOD_OVERFLOW(type a, type b) {                               \
     return type ## _DIV_OVERFLOW(a, b);                                                 \
 }                                                                                       \
-static INLINE int __attribute__((unused)) DO_ ## type ## _MOD_OVERFLOW(type a, type b, type * res) {            \
+static INLINE int ATTRIBUTE((unused)) DO_ ## type ## _MOD_OVERFLOW(type a, type b, type * res) {            \
     if (type ## _MOD_OVERFLOW(a, b)) {                                                  \
         return 1;                                                                       \
     }                                                                                   \
     *res = a % b;                                                                       \
     return 0;                                                                           \
 }                                                                                       \
-static INLINE int __attribute__((unused)) type ## _LSH_OVERFLOW(type a, type b) {                               \
+static INLINE int ATTRIBUTE((unused)) type ## _LSH_OVERFLOW(type a, type b) {                               \
     type size = (type)sizeof(type)*CHAR_BIT;                                            \
     return (b < 0 || b >= size || ((a<<b)>>b)!=a);			\
 }                                                                                       \
- static INLINE int __attribute__((unused)) type ## _RSH_OVERFLOW(type UNUSED(a), type b) { \
+ static INLINE int ATTRIBUTE((unused)) type ## _RSH_OVERFLOW(type UNUSED(a), type b) { \
    return b>=(type)sizeof(type)*CHAR_BIT;					\
 }                                                                                       \
-static INLINE int __attribute__((unused)) DO_ ## type ## _LSH_OVERFLOW(type a, type b, type * res) {            \
+static INLINE int ATTRIBUTE((unused)) DO_ ## type ## _LSH_OVERFLOW(type a, type b, type * res) {            \
     if (type ## _LSH_OVERFLOW(a, b)) return 1;                                          \
     *res = a << b;                                                                      \
     return 0;                                                                           \
 }                                                                                       \
-static INLINE int __attribute__((unused)) DO_ ## type ## _RSH_OVERFLOW(type a, type b, type * res) {            \
+static INLINE int ATTRIBUTE((unused)) DO_ ## type ## _RSH_OVERFLOW(type a, type b, type * res) {            \
     if (type ## _RSH_OVERFLOW(a, b)) return 1;                                          \
     *res = a >> b;                                                                      \
     return 0;                                                                           \
 }
 
 #define _GEN_OF2(type, type2, utype2, size)                                             \
-static INLINE int __attribute__((unused)) DO_ ## type ## _ADD_OVERFLOW(type a, type b, type * res) {            \
+static INLINE int ATTRIBUTE((unused)) DO_ ## type ## _ADD_OVERFLOW(type a, type b, type * res) {            \
     type2 tmp;                                                                          \
     tmp = (type2)a + (type2)b;                                                          \
     if (tmp < MIN_ ## type || tmp > MAX_ ## type)                                       \
@@ -112,7 +112,7 @@ static INLINE int __attribute__((unused)) DO_ ## type ## _ADD_OVERFLOW(type a, t
     *res = (type)tmp;                                                                   \
     return 0;                                                                           \
 }                                                                                       \
-static INLINE int __attribute__((unused)) DO_ ## type ## _SUB_OVERFLOW(type a, type b, type * res) {            \
+static INLINE int ATTRIBUTE((unused)) DO_ ## type ## _SUB_OVERFLOW(type a, type b, type * res) {            \
     type2 tmp;                                                                          \
     tmp = (type2)a - (type2)b;                                                          \
     if (tmp < MIN_ ## type || tmp > MAX_ ## type)                                       \
@@ -120,7 +120,7 @@ static INLINE int __attribute__((unused)) DO_ ## type ## _SUB_OVERFLOW(type a, t
     *res = (type)tmp;                                                                   \
     return 0;                                                                           \
 }                                                                                       \
-static INLINE int __attribute__((unused)) DO_ ## type ## _MUL_OVERFLOW(type a, type b, type * res) {            \
+static INLINE int ATTRIBUTE((unused)) DO_ ## type ## _MUL_OVERFLOW(type a, type b, type * res) {            \
     type2 tmp;                                                                          \
     tmp = (type2)a * (type2)b;                                                          \
     if (tmp < MIN_ ## type || tmp > MAX_ ## type)                                       \
@@ -128,7 +128,7 @@ static INLINE int __attribute__((unused)) DO_ ## type ## _MUL_OVERFLOW(type a, t
     *res = (type)tmp;                                                                   \
     return 0;                                                                           \
 }                                                                                       \
-static INLINE int __attribute__((unused)) DO_U ## type ## _ADD_OVERFLOW(unsigned type a, unsigned type b,       \
+static INLINE int ATTRIBUTE((unused)) DO_U ## type ## _ADD_OVERFLOW(unsigned type a, unsigned type b,       \
                                                 unsigned type * res) {                  \
     utype2 tmp;                                                                         \
     tmp = (utype2)a + (utype2)b;                                                        \
@@ -136,7 +136,7 @@ static INLINE int __attribute__((unused)) DO_U ## type ## _ADD_OVERFLOW(unsigned
     *res = (unsigned type)tmp;                                                          \
     return 0;                                                                           \
 }                                                                                       \
-static INLINE int __attribute__((unused)) DO_U ## type ## _MUL_OVERFLOW(unsigned type a, unsigned type b,       \
+static INLINE int ATTRIBUTE((unused)) DO_U ## type ## _MUL_OVERFLOW(unsigned type a, unsigned type b,       \
                                                 unsigned type * res) {                  \
     utype2 tmp;                                                                         \
     tmp = (utype2)a * (utype2)b;                                                        \
@@ -146,21 +146,21 @@ static INLINE int __attribute__((unused)) DO_U ## type ## _MUL_OVERFLOW(unsigned
 }
 
 #define _GEN_OF1(type, size)                                                            \
-static INLINE int __attribute__((unused)) DO_ ## type ## _ADD_OVERFLOW(type a, type b, type * res) {            \
+static INLINE int ATTRIBUTE((unused)) DO_ ## type ## _ADD_OVERFLOW(type a, type b, type * res) {            \
     if ((b > 0 && a > MAX_ ## type - b) ||                                              \
         (b < 0 && a < MIN_ ## type - b))                                                \
         return 1;                                                                       \
     *res = a + b;                                                                       \
     return 0;                                                                           \
 }                                                                                       \
-static INLINE int __attribute__((unused)) DO_ ## type ## _SUB_OVERFLOW(type a, type b, type * res) {            \
+static INLINE int ATTRIBUTE((unused)) DO_ ## type ## _SUB_OVERFLOW(type a, type b, type * res) {            \
     if ((b > 0 && a < MIN_ ## type + b) ||                                              \
         (b < 0 && a > MAX_ ## type + b))                                                \
         return 1;                                                                       \
     *res = a - b;                                                                       \
     return 0;                                                                           \
 }                                                                                       \
-static INLINE int __attribute__((unused)) DO_## type ## _MUL_OVERFLOW(type a, type b, type * res) {             \
+static INLINE int ATTRIBUTE((unused)) DO_## type ## _MUL_OVERFLOW(type a, type b, type * res) {             \
     if (a > 0) {                                                                        \
       if (b > 0) {                                                                      \
         if (a > (MAX_ ## type / b)) {                                                   \
@@ -185,14 +185,14 @@ static INLINE int __attribute__((unused)) DO_## type ## _MUL_OVERFLOW(type a, ty
     *res = a * b;                                                                       \
     return 0;                                                                           \
 }                                                                                       \
-static INLINE int __attribute__((unused)) DO_U ## type ## _ADD_OVERFLOW(unsigned type a, unsigned type b,       \
+static INLINE int ATTRIBUTE((unused)) DO_U ## type ## _ADD_OVERFLOW(unsigned type a, unsigned type b,       \
                                                 unsigned type * res) {                  \
     if (a > MAX_U ## type - b)                                                          \
         return 1;                                                                       \
     *res = a + b;                                                                       \
     return 0;                                                                           \
 }                                                                                       \
-static INLINE int __attribute__((unused)) DO_U ## type ## _MUL_OVERFLOW(unsigned type a, unsigned type b,       \
+static INLINE int ATTRIBUTE((unused)) DO_U ## type ## _MUL_OVERFLOW(unsigned type a, unsigned type b,       \
                                                 unsigned type * res) {                  \
     unsigned type tmp = 0;                                                              \
     unsigned type bits = size/2;                                                        \
@@ -213,7 +213,7 @@ static INLINE int __attribute__((unused)) DO_U ## type ## _MUL_OVERFLOW(unsigned
 }                                                                                       \
 
 #define GEN_USUB_OF(type)                                                               \
-static INLINE int __attribute__((unused)) DO_U ## type ## _SUB_OVERFLOW(unsigned type a, unsigned type b,       \
+static INLINE int ATTRIBUTE((unused)) DO_U ## type ## _SUB_OVERFLOW(unsigned type a, unsigned type b,       \
                                                 unsigned type * res) {                  \
     if (b > a)                                                                          \
         return 1;                                                                       \
@@ -232,7 +232,7 @@ static INLINE int __attribute__((unused)) DO_U ## type ## _SUB_OVERFLOW(unsigned
 
 #if PIKE_CLANG_BUILTIN(__builtin_uadd_overflow)
 #define DO_CLANG_OF(name, type, builtin)                \
-static INLINE int __attribute__((unused)) name(type a, type b, type * res) {    \
+static INLINE int ATTRIBUTE((unused)) name(type a, type b, type * res) {    \
     type tmp;                                           \
     if (builtin(a, b, &tmp)) return 1;                  \
     *res = tmp;                                         \
@@ -292,11 +292,11 @@ GEN_OF2(16, 32, unsigned INT32)
  *     of the correct type as temporaries, and then copying the result.
  */
 #define _GEN_UNOP(OP, type1, TYPE1, type2, name)			\
-  static INLINE int __attribute__((unused)) name ## _ ## OP ## _OVERFLOW(type2 a) {		\
+  static INLINE int ATTRIBUTE((unused)) name ## _ ## OP ## _OVERFLOW(type2 a) {		\
     type1 tmp;							        \
       return (DO_## TYPE1 ## _ ## OP ## _OVERFLOW(a, &tmp));		\
   }									\
-  static INLINE int __attribute__((unused)) DO_ ## name ## _ ## OP ## _OVERFLOW(type2 a,	\
+  static INLINE int ATTRIBUTE((unused)) DO_ ## name ## _ ## OP ## _OVERFLOW(type2 a,	\
 						        type2 *res) {	\
     type1 tmp;							        \
     if (DO_ ## TYPE1 ## _ ## OP ## _OVERFLOW(a, &tmp)) return 1;	\
@@ -304,11 +304,11 @@ GEN_OF2(16, 32, unsigned INT32)
     return 0;								\
   }
 #define _GEN_BINOP(OP, type1, TYPE1, type2, name)			\
-  static INLINE int __attribute__((unused)) name ## _ ## OP ## _OVERFLOW(type2 a, type2 b) {	\
+  static INLINE int ATTRIBUTE((unused)) name ## _ ## OP ## _OVERFLOW(type2 a, type2 b) {	\
     type1 tmp;							        \
     return (DO_ ## TYPE1 ## _ ## OP ## _OVERFLOW(a, b, &tmp));	        \
   }									\
-  static INLINE int __attribute__((unused)) DO_ ## name ## _ ## OP ## _OVERFLOW(type2 a,	\
+  static INLINE int ATTRIBUTE((unused)) DO_ ## name ## _ ## OP ## _OVERFLOW(type2 a,	\
                                                         type2 b,	\
                                                         type2 *res) {	\
     type1 tmp;	        						\
diff --git a/src/bitvector.h b/src/bitvector.h
index a469379b61819941b2688c8b8f7d2c69997f81e8..3c0ebbbefc8973d2bc59678cfaa2eddce68558b9 100644
--- a/src/bitvector.h
+++ b/src/bitvector.h
@@ -20,7 +20,7 @@ static const char logTable[256] = {
 };
 #undef LT
 
-static INLINE unsigned INT32 __attribute__((unused)) clz32(unsigned INT32 i) {
+static INLINE unsigned INT32 ATTRIBUTE((unused)) clz32(unsigned INT32 i) {
 #ifdef HAS___BUILTIN_CLZ
     return i ? __builtin_clz(i) : 32;
 #elif defined(HAS__BIT_SCAN_REVERSE)
@@ -32,7 +32,6 @@ static INLINE unsigned INT32 __attribute__((unused)) clz32(unsigned INT32 i) {
     if (_BitScanReverse(&index, (unsigned long)i))
 	return (unsigned INT32)index;
     return 32;
-}
 #else
     unsigned INT32 t;
 
@@ -51,7 +50,7 @@ static INLINE unsigned INT32 __attribute__((unused)) clz32(unsigned INT32 i) {
 #define clz16(i) (clz32(i) - 16)
 #define clz8(i) (clz32(i) - 24)
 
-static INLINE unsigned INT32 __attribute__((unused)) ctz32(unsigned INT32 i) {
+static INLINE unsigned INT32 ATTRIBUTE((unused)) ctz32(unsigned INT32 i) {
 #ifdef HAS___BUILTIN_CTZ
     return i ? __builtin_ctz(i) : 32;
 #elif defined(HAS__BIT_SCAN_FORWARD)
@@ -77,7 +76,7 @@ static INLINE unsigned INT32 __attribute__((unused)) ctz32(unsigned INT32 i) {
 #define ctz8(i) (i ? ctz32(i) : 8)
 
 
-static INLINE unsigned INT32 __attribute__((unused)) bswap32(unsigned INT32 x) {
+static INLINE unsigned INT32 ATTRIBUTE((unused)) bswap32(unsigned INT32 x) {
 #ifdef HAS___BUILTIN_BSWAP32
     return __builtin_bswap32(x);
 #elif defined(HAS__BSWAP)
@@ -92,7 +91,7 @@ static INLINE unsigned INT32 __attribute__((unused)) bswap32(unsigned INT32 x) {
 
 #ifdef INT64
 
-static INLINE unsigned INT32 __attribute__((unused)) clz64(unsigned INT64 i) {
+static INLINE unsigned INT32 ATTRIBUTE((unused)) clz64(unsigned INT64 i) {
 # if SIZEOF_LONG == 8 && defined(HAS___BUILTIN_CLZL)
     return i ? __builtin_clzl(i) : 64;
 # elif SIZEOF_LONG_LONG == 8 && defined(HAS___BUILTIN_CLZLL)
@@ -127,7 +126,7 @@ static INLINE unsigned INT32 __attribute__((unused)) clz64(unsigned INT64 i) {
 # endif
 }
 
-static INLINE unsigned INT32 __attribute__((unused)) ctz64(unsigned INT64 i) {
+static INLINE unsigned INT32 ATTRIBUTE((unused)) ctz64(unsigned INT64 i) {
 # if SIZEOF_LONG == 8 && defined(HAS___BUILTIN_CTZL)
     return i ? __builtin_ctzl(i) : 64;
 # elif SIZEOF_LONG_LONG == 8 && defined(HAS___BUILTIN_CTZLL)
@@ -151,7 +150,7 @@ static INLINE unsigned INT32 __attribute__((unused)) ctz64(unsigned INT64 i) {
 # endif
 }
 
-static INLINE unsigned INT64 __attribute__((unused)) bswap64(unsigned INT64 x) {
+static INLINE unsigned INT64 ATTRIBUTE((unused)) bswap64(unsigned INT64 x) {
 #ifdef HAS___BUILTIN_BSWAP64
     return __builtin_bswap64(x);
 #elif defined(HAS__BSWAP64)
@@ -163,7 +162,7 @@ static INLINE unsigned INT64 __attribute__((unused)) bswap64(unsigned INT64 x) {
 #endif
 }
 
-static INLINE unsigned INT64 __attribute__((unused)) round_up64(unsigned INT64 v) {
+static INLINE unsigned INT64 ATTRIBUTE((unused)) round_up64(unsigned INT64 v) {
     unsigned INT64 i;
 
     if (!v) return 0;
@@ -171,21 +170,21 @@ static INLINE unsigned INT64 __attribute__((unused)) round_up64(unsigned INT64 v
     return (unsigned INT64)1 << (64 - clz64(v));
 }
 
-static INLINE unsigned INT32 __attribute__((unused)) ffs64(unsigned INT64 v) {
+static INLINE unsigned INT32 ATTRIBUTE((unused)) ffs64(unsigned INT64 v) {
     return ctz64(v) + 1;
 }
 
-static INLINE unsigned INT32 __attribute__((unused)) fls64(unsigned INT64 v) {
+static INLINE unsigned INT32 ATTRIBUTE((unused)) fls64(unsigned INT64 v) {
     return 64 - clz64(v);
 }
 
 /* returns -1 for 0 */
-static INLINE unsigned INT32 __attribute__((unused)) log2_u64(unsigned INT64 v) {
+static INLINE unsigned INT32 ATTRIBUTE((unused)) log2_u64(unsigned INT64 v) {
     return fls64(v) - 1;
 }
 #endif /* INT64 */
 
-static INLINE unsigned INT32 __attribute__((unused)) round_up32(unsigned INT32 v) {
+static INLINE unsigned INT32 ATTRIBUTE((unused)) round_up32(unsigned INT32 v) {
     unsigned INT32 i;
 
     if (!v) return 0;
@@ -193,16 +192,16 @@ static INLINE unsigned INT32 __attribute__((unused)) round_up32(unsigned INT32 v
     return 1U << (32 - clz32(v));
 }
 
-static INLINE unsigned INT32 __attribute__((unused)) ffs32(unsigned INT32 v) {
+static INLINE unsigned INT32 ATTRIBUTE((unused)) ffs32(unsigned INT32 v) {
     return ctz32(v) + 1;
 }
 
-static INLINE unsigned INT32 __attribute__((unused)) fls32(unsigned INT32 v) {
+static INLINE unsigned INT32 ATTRIBUTE((unused)) fls32(unsigned INT32 v) {
     return 32 - clz32(v);
 }
 
 /* returns -1 for 0 */
-static INLINE unsigned INT32 __attribute__((unused)) log2_u32(unsigned INT32 v) {
+static INLINE unsigned INT32 ATTRIBUTE((unused)) log2_u32(unsigned INT32 v) {
     return fls32(v) - 1;
 }
 
diff --git a/src/global.h b/src/global.h
index 6043e1ac000ad1ecfb17dd6de7c2e4bd1466e624..56cf334254f4a281ceab03258272a26d9d063144 100644
--- a/src/global.h
+++ b/src/global.h
@@ -560,7 +560,7 @@ typedef struct p_wchar_p
    removing the annotation. */
 #ifndef PIKE_UNUSED_ATTRIBUTE
 # ifdef __GNUC__
-#  define PIKE_UNUSED_ATTRIBUTE  __attribute__((unused))
+#  define PIKE_UNUSED_ATTRIBUTE  ATTRIBUTE((unused))
 # else
 #  define PIKE_UNUSED_ATTRIBUTE
 # endif
diff --git a/src/interpret_functions.h b/src/interpret_functions.h
index 850a24e26b7a2ff4d86493fc0cfd8acc6ec8e582..288e237d57d46370d4e1d40d696bbeae216e555a 100644
--- a/src/interpret_functions.h
+++ b/src/interpret_functions.h
@@ -416,6 +416,7 @@ OPCODE2(F_ASSIGN_PRIVATE_TYPED_GLOBAL_AND_POP, "assign global <private,typed> an
   pop_stack();
 });
 
+
 OPCODE2(F_ASSIGN_PRIVATE_TYPED_GLOBAL, "assign global <private,typed>", 0, {
   union anything  *tmp;
   LOCAL_VAR(struct object *o);
@@ -426,6 +427,8 @@ OPCODE2(F_ASSIGN_PRIVATE_TYPED_GLOBAL, "assign global <private,typed>", 0, {
   assign_to_short_svalue( tmp, arg2, Pike_sp-1);
 });
 
+/* This define exists because msvc cannot cope with precompiler directives within a macro expansion. */
+#if SIZEOF_FLOAT_TYPE != SIZEOF_INT_TYPE
 
 OPCODE2(F_PRIVATE_TYPED_GLOBAL, "global <private,typed>", I_UPDATE_SP, {
     void *ptr;
@@ -435,16 +438,41 @@ OPCODE2(F_PRIVATE_TYPED_GLOBAL, "global <private,typed>", I_UPDATE_SP, {
     ptr = (void *)(o->storage + Pike_fp->context->storage_offset + arg1);
     if( arg2 < MIN_REF_TYPE )
     {
-#if SIZEOF_FLOAT_TYPE != SIZEOF_INT_TYPE
       if( UNLIKELY(arg2)==PIKE_T_INT )
 	push_int( *(INT_TYPE*)ptr );
       else
 	push_float( *(FLOAT_TYPE*)ptr );
-#else
+    }
+    else
+    {
+      INT32 *refs = *(INT32**)ptr;
+      if( !refs )
+	push_undefined();
+      else
+      {
+	struct svalue tmp;
+	SET_SVAL_TYPE_SUBTYPE(tmp,arg2,0);
+	tmp.u.refs = refs;
+	push_svalue(&tmp);
+      }
+    }
+
+    print_return_value();
+});
+
+#else /* SIZEOF_FLOAT_TYPE != SIZEOF_INT_TYPE */
+
+OPCODE2(F_PRIVATE_TYPED_GLOBAL, "global <private,typed>", I_UPDATE_SP, {
+    void *ptr;
+    LOCAL_VAR(struct object *o);
+
+    o = Pike_fp->current_object;
+    ptr = (void *)(o->storage + Pike_fp->context->storage_offset + arg1);
+    if( arg2 < MIN_REF_TYPE )
+    {
       SET_SVAL_TYPE_SUBTYPE(Pike_sp[0],arg2,0);
       Pike_sp[0].u.integer = *(INT_TYPE*)ptr;
       Pike_sp++;
-#endif
     }
     else
     {
@@ -463,6 +491,8 @@ OPCODE2(F_PRIVATE_TYPED_GLOBAL, "global <private,typed>", I_UPDATE_SP, {
     print_return_value();
 });
 
+#endif /* SIZEOF_FLOAT_TYPE != SIZEOF_INT_TYPE */
+
 OPCODE2_TAIL(F_MARK_AND_EXTERNAL, "mark & external", I_UPDATE_SP|I_UPDATE_M_SP, {
   *(Pike_mark_sp++)=Pike_sp;
 
diff --git a/src/modules/_Stdio/buffer.cmod b/src/modules/_Stdio/buffer.cmod
index c20dc81aa6e145556dfb3666bf792ab8a36778be..b0ad4308d8ff17f17592ef9bb3f82d4f3865800e 100644
--- a/src/modules/_Stdio/buffer.cmod
+++ b/src/modules/_Stdio/buffer.cmod
@@ -25,10 +25,17 @@
 #include "buffer.h"
 #include "module_support.h"
 
+#ifdef HAVE_ARPA_INET_H
 #include <arpa/inet.h>
+#endif
+
 #undef MP_INT
 #include <gmp.h>
 
+#ifndef HAVE_SSIZE_T
+#define ssize_t SIZE_T
+#endif /* HAVE_SSIZE_T */
+
 #define DEFAULT_CMOD_STORAGE static
 DECLARATIONS
 
@@ -372,8 +379,8 @@ PIKECLASS Buffer
     }
   }
 
-  static struct pike_string *io_read_string( Buffer *io, ssize_t len )
-    ATTRIBUTE((noclone,noinline));
+  static struct pike_string *io_read_string( Buffer *io, ssize_t len ) ATTRIBUTE((noclone,noinline));
+
   static size_t io_rewind( Buffer *io, INT_TYPE n );
 
   static void io_do_rewind_on_error( struct rewind_to *e )
diff --git a/src/modules/_Stdio/configure.in b/src/modules/_Stdio/configure.in
index 7af322f6ed8b7abe336fcc9b2e615e1613fc62fc..f9ffa04ddaa863f4d1230ef552be677de48de504 100644
--- a/src/modules/_Stdio/configure.in
+++ b/src/modules/_Stdio/configure.in
@@ -55,7 +55,6 @@ if test "x$ac_cv_header_sys_sendfile_h" = "xyes"; then
   fi
 fi
 
-
 AC_HEADER_DIRENT
 AC_CHECK_LIB(bind, __inet_ntoa)
 AC_CHECK_LIB(socket, socket)
@@ -211,6 +210,22 @@ else
   AC_MSG_RESULT(no)
 fi
 
+AC_MSG_CHECKING(if ssize_t is defined)
+AC_CACHE_VAL(pike_cv_ssize_t_defined, [
+	AC_TRY_COMPILE([
+], [
+	ssize_t sz;
+],  [pike_cv_ssize_t_defined=yes],[pike_cv_ssize_t_defined=no])
+])
+
+if test "$pike_cv_ssize_t_defined" = "yes"; then
+  AC_MSG_RESULT(yes)
+  AC_DEFINE(HAVE_SSIZE_T)
+else
+  AC_MSG_RESULT(no)
+fi
+
+
 AC_MSG_CHECKING([if struct sockaddr_un has a sun_len member (BSD)])
 AC_CACHE_VAL(pike_cv_struct_sockaddr_un_sun_len, [
 	AC_TRY_COMPILE([
diff --git a/src/modules/_Stdio/file.h b/src/modules/_Stdio/file.h
index 6ad17da724498b145c5654da721967c6108973cc..6ab5cbee386eeb746edbd0315b95f4fddf04ec5a 100644
--- a/src/modules/_Stdio/file.h
+++ b/src/modules/_Stdio/file.h
@@ -4,6 +4,7 @@
 || for more information.
 */
 
+#include <io.h>
 #ifndef FILE_H
 #define FILE_H
 
@@ -60,6 +61,18 @@
 #define IPPROTO_IPV6 IPPROTO_IPV6
 #endif
 
+/* Provide some values not provided by windows (and without a direct equivalent) */
+#ifndef R_OK
+#define R_OK    4       /* Test for read permission.  */
+#endif
+#ifndef W_OK
+#define W_OK    2       /* Test for write permission.  */
+#endif
+#define   X_OK    R_OK  /* execute permission - unsupported in windows*/
+#ifndef F_OK
+#define F_OK    0       /* Test for existence.  */
+#endif
+
 struct my_file
 {
   struct fd_callback_box box;	/* Must be first. */