diff --git a/tcc.h b/tcc.h index aa04404a..ac50a6da 100644 --- a/tcc.h +++ b/tcc.h @@ -65,12 +65,11 @@ extern long double strtold (const char *__nptr, char **__endptr); # ifndef __GNUC__ # define strtold (long double)strtod # define strtof (float)strtod -# ifdef _WIN64 +# ifndef strtoll # define strtoll _strtoi64 +# endif +# ifndef strtoull # define strtoull _strtoui64 -# else -# define strtoll strtol -# define strtoull strtoul # endif # endif # ifdef LIBTCC_AS_DLL diff --git a/win32/include/stdlib.h b/win32/include/stdlib.h index 033c0fdf..36e8b60d 100644 --- a/win32/include/stdlib.h +++ b/win32/include/stdlib.h @@ -536,7 +536,7 @@ extern "C" { #endif #endif -#if !defined __NO_ISOCEXT /* externs in static libmingwex.a */ +#if !defined __NO_ISOCEXT typedef struct { long long quot, rem; } lldiv_t; @@ -544,8 +544,18 @@ extern "C" { __CRT_INLINE long long __cdecl llabs(long long _j) { return (_j >= 0 ? _j : -_j); } + /* stro[u]ll do not properly map in Windows; use macros as VC++ does */ + #if !defined(strtoll) + #define strtoll _strtoi64 + #endif + #if !defined(strtoull) + #define strtoull _strtoui64 + #endif + +/* long long __cdecl strtoll(const char* __restrict__, char** __restrict, int); unsigned long long __cdecl strtoull(const char* __restrict__, char** __restrict__, int); +*/ /* these are stubs for MS _i64 versions */ long long __cdecl atoll (const char *);