From: Jacek Caban <jacek@codeweavers.com> --- dlls/msvcrt/math.c | 8 ++------ include/msvcrt/stdlib.h | 9 ++++----- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index 20f3b08bb54..8ea434c2176 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -1992,7 +1992,7 @@ int CDECL _gcvt_s(char *buff, size_t size, double number, int digits) * VERSION * [i386] Windows binary compatible - returns the struct in eax/edx. */ -#ifdef __i386__ +#if defined(__i386__) && !defined(__WINE_PE_BUILD) unsigned __int64 CDECL div(int num, int denom) { union { @@ -2007,8 +2007,6 @@ unsigned __int64 CDECL div(int num, int denom) #else /********************************************************************* * div (MSVCRT.@) - * VERSION - * [!i386] Non-x86 can't run win32 apps so we don't need binary compatibility */ div_t CDECL div(int num, int denom) { @@ -2026,7 +2024,7 @@ div_t CDECL div(int num, int denom) * VERSION * [i386] Windows binary compatible - returns the struct in eax/edx. */ -#ifdef __i386__ +#if defined(__i386__) && !defined(__WINE_PE_BUILD) unsigned __int64 CDECL ldiv(__msvcrt_long num, __msvcrt_long denom) { union { @@ -2041,8 +2039,6 @@ unsigned __int64 CDECL ldiv(__msvcrt_long num, __msvcrt_long denom) #else /********************************************************************* * ldiv (MSVCRT.@) - * VERSION - * [!i386] Non-x86 can't run win32 apps so we don't need binary compatibility */ ldiv_t CDECL ldiv(__msvcrt_long num, __msvcrt_long denom) { diff --git a/include/msvcrt/stdlib.h b/include/msvcrt/stdlib.h index a74e88dd65e..5e69a270ebd 100644 --- a/include/msvcrt/stdlib.h +++ b/include/msvcrt/stdlib.h @@ -214,10 +214,6 @@ _ACRTIMP int __cdecl atoi(const char*); _ACRTIMP int __cdecl _atoi_l(const char*,_locale_t); _ACRTIMP __msvcrt_long __cdecl atol(const char*); _ACRTIMP __int64 __cdecl atoll(const char*); -#ifndef __i386__ -_ACRTIMP div_t __cdecl div(int,int); -_ACRTIMP ldiv_t __cdecl ldiv(__msvcrt_long,__msvcrt_long); -#endif _ACRTIMP lldiv_t __cdecl lldiv(__int64,__int64); _ACRTIMP DECLSPEC_NORETURN void __cdecl exit(int); _ACRTIMP char* __cdecl getenv(const char*); @@ -300,7 +296,10 @@ static inline unsigned __int64 __cdecl strtoull(const char *ptr, char **endptr, static inline void swab(char* src, char* dst, int len) { _swab(src, dst, len); } static inline char* ultoa(__msvcrt_ulong value, char* str, int radix) { return _ultoa(value, str, radix); } -#ifdef __i386__ +#if !defined(__i386__) || defined(_MSC_VER) || defined(__MINGW32__) +_ACRTIMP div_t __cdecl div(int,int); +_ACRTIMP ldiv_t __cdecl ldiv(__msvcrt_long,__msvcrt_long); +#else static inline div_t __wine_msvcrt_div(int num, int denom) { extern unsigned __int64 div(int,int); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10129