在 2018/11/5 3:02, Mateusz 写道:
> I have problems with functions:
> _ftime32, _ftime64, _ftime, _ftime32_s, _ftime64_s, _ftime_s
> 
> There is no declaration for *32 functions.
> 
> In 64-bit libmsvcrt.a there is no _ftime32 function.
> 

This isn't the case at least for me on Win7 Professional. Both x86 and
x64 'MSVCRT.DLL's export all of these five functions:

  * _ftime
  * _ftime32
  * _ftime32_s
  * _ftime64
  * _ftime64_s

`git blame msvcrt.def.in` recovered the line `F_ARM_ANY(_ftime32)` was
added by `1035bed24`, whose commit message stated XP compatibility.


> In 32-bit mode _ftime and _ftime_s are always *32 regardless of 
> _USE_32BIT_TIME_T (but in _mingw.h we always define _USE_32BIT_TIME_T for 
> 32-bit)
> #if defined (_WIN32) && !defined (_WIN64) && !defined 
> (__MINGW_USE_VC2005_COMPAT)
> #ifndef _USE_32BIT_TIME_T
> #define _USE_32BIT_TIME_T
> 
> In 32/64-bit libmsvcr120.a there is no _ftime and _ftime_s function (which is 
> currently declared) and this gives link error.
> 

Verified.

> In 64-bit libucrt.a _ftime function is mapped to _ftime32: in 
> mingw-w64-crt/lib-common/ucrtbase.def.in
> _ftime == _ftime32
> 
> My proposition is:
> We could add _ftime32 to 64-bit libmsvcrt.a and alias _ftime32 as _ftime in 
> 32-bit libmsvcrt.a -- in msvcrt.dll from WinXPsp2 there are only _ftime and 
> _ftime64 functions.
> In header files we could declare *32 functions and define _ftime and _ftime_s 
> according to _USE_32BIT_TIME_T.
> 
> I've attached patch that do this.
> 
> Sample program should be compiled with
> -DMINGW_HAS_SECURE_API
> option.
> 
> Please review.
>

These patches look good, except for this:

>    _CRTIMP void __cdecl _ftime64(struct __timeb64 *_Time);
> +  _CRTIMP void __cdecl _ftime32(struct __timeb32 *);

where the parameter of `_ftime32` shouldn't be nameless. But it's a
minor issue, I can amend it.


-- 
Best regards,
LH_Mouse

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to