diff --git a/include/SWI-Prolog.h b/include/SWI-Prolog.h index f9a05d7a4..29107330c 100755 --- a/include/SWI-Prolog.h +++ b/include/SWI-Prolog.h @@ -111,12 +111,15 @@ stuff. #ifdef __WINDOWS__ +#ifndef INT64_T_DEFINED +#define INT64_T_DEFINED 1 typedef __int64 int64_t; typedef unsigned __int64 uint64_t; -#if (_MSC_VER < 1300) +#if (_MSC_VER < 1300) && !defined(__MINGW32__) typedef long intptr_t; typedef unsigned long uintptr_t; #endif +#endif #else #include /* more portable than stdint.h */ #endif @@ -131,12 +134,7 @@ typedef uintptr_t functor_t; typedef int (*PL_agc_hook_t)(atom_t); typedef unsigned long foreign_t; /* return type of foreign functions */ typedef wchar_t pl_wchar_t; /* wide character support */ -#ifdef WIN32 -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; -#else #include /* more portable than stdint.h */ -#endif #if !defined(_MSC_VER) typedef uintptr_t PL_fid_t; /* opaque foreign context handle */ #endif @@ -663,7 +661,6 @@ PL_EXPORT(int) PL_foreign_control(control_t); PL_EXPORT(intptr_t) PL_foreign_context(control_t); PL_EXPORT(void *) PL_foreign_context_address(control_t); - /* SWI stream info */ PL_EXPORT(void) PL_YAP_InitSWIIO(functor_t f, void *gc, diff --git a/include/SWI-Stream.h b/include/SWI-Stream.h index 9e5b1ad21..542503576 100755 --- a/include/SWI-Stream.h +++ b/include/SWI-Stream.h @@ -46,12 +46,16 @@ #include #include #ifdef __WINDOWS__ +#ifndef INT64_T_DEFINED +#define INT64_T_DEFINED 1 typedef __int64 int64_t; +typedef unsigned __int64 uint64_t; #if (_MSC_VER < 1300) && !defined(__MINGW32__) typedef long intptr_t; typedef unsigned long uintptr_t; typedef intptr_t ssize_t; /* signed version of size_t */ #endif +#endif #else #include #include /* more portable than stdint.h */ @@ -207,7 +211,7 @@ PL_EXPORT(IOSTREAM *) S__getiob(void); /* get DLL's __iob[] address */ PL_EXPORT_DATA(IOFUNCTIONS) Sfilefunctions; /* OS file functions */ PL_EXPORT_DATA(int) Slinesize; /* Sgets() linesize */ -#if defined(__CYGWIN__) && !defined(PL_KERNEL) +#if (defined(__CYGWIN__) || defined(__MINGW32__)) && !defined(PL_KERNEL) #define S__iob S__getiob() #else PL_EXPORT_DATA(IOSTREAM) S__iob[3]; /* Libs standard streams */