[MinGW-Notify] [mingw] #37938: Conflicts in time_t type definition between MSVCRT.DLL, UCRTBASE.DLL, and VC++ non-free runtimes

MinGW Notification List mingw****@lists*****
Tue Mar 6 07:00:11 JST 2018


#37938: Conflicts in time_t type definition between MSVCRT.DLL, UCRTBASE.DLL, and VC++ non-free runtimes

  Open Date: 2018-02-03 18:05
Last Update: 2018-03-05 22:00

URL for this Ticket:
    https://osdn.net//projects/mingw/ticket/37938
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=37938

---------------------------------------------------------------------

Last Changes/Comment on this Ticket:
2018-03-05 22:00 Updated by: keith

Comment:

A related issue arises, in connection with the GetAdaptersInfo() API, as implemented within iphlpapi.dll ... specifically within the IP_ADAPTERS_INFO structural data type, (which is defined in <iptypes.h>), which is used to retrieve the adapters info.  As documented by Microsoft, each entry in this structured array includes a pair of time_t fields; in reality, on 32-bit Windows, the iphlpapi.dll implementation requires each of these to be defined as __time32_t fields.
Microsoft's suggested work-around for this anomaly is to require users to specify _USE_32BIT_TIME_T within any translation unit, compiled for 32-bit Windows, in which the IP_ADAPTERS_INFO data type is referenced.  This is abysmally poor systems engineering; users should not have to contend with such nonsense!  The attached iptypes-self-contained.patch corrects this, in a completely deterministic fashion which does not require such user intervention, while simultaneously ensuring that <iptypes.h> may be included without imposing, on users, the onus for resolving its additional header file dependencies.
(This iptypes-self-contained.patch has already been committed to the WSL repository, and incorporated into the w32api-5.1 release).

---------------------------------------------------------------------
Ticket Status:

      Reporter: keith
         Owner: keith
          Type: Issues
        Status: Open [Owner assigned]
      Priority: 5 - Medium
     MileStone: (None)
     Component: WSL
      Severity: 5 - Medium
    Resolution: None
---------------------------------------------------------------------

Ticket details:

According to this Microsoft on-line documentation:
In versions of Visual C++ and Microsoft C/C++ before Visual C++ 2005, time_t was a long int (32 bits) 
and hence could not be used for dates past 3:14:07 January 19, 2038, UTC.  time_t is now equivalent to 
__time64_t by default, but defining _USE_32BIT_TIME_T changes time_t to __time32_t and forces many time 
functions to call versions that take the 32-bit time_t.  For more information, see Standard Types and 
comments in the documentation for the individual time functions.
While this may be true, for applications which are built using Microsoft's Visual C++, (specifically from the 2005 version onward), and linked with the accompanying non-free versions of Microsoft's C-Runtime library, (from MSVCR80.DLL onward, and perhaps also with the pseudo-free UCRTBASE.DLL), it is manifestly untrue for applications which are linked with the pseudo-free MSVCRT.DLL, (the normal case for MinGW applications), as it is for applications which are built with, and linked with the C-Runtime libraries which accompanied, earlier (legacy) versions of Microsoft's Visual C++, (i.e. applications which are linked with Microsoft's non-free runtime libraries pre-dating MSVCR80.DLL).
We need to engineer a time management API which will accommodate the disparities between MSVCRT.DLL, UCRTBASE.DLL, and Microsoft's post-2005 Visual C++ implementations of various time management functions, and we must recognise that our API cannot blindly conform to the above paragraph from Microsoft's current documentation.


-- 
Ticket information of MinGW - Minimalist GNU for Windows project
MinGW - Minimalist GNU for Windows Project is hosted on OSDN

Project URL: https://osdn.net/projects/mingw/
OSDN: https://osdn.net

URL for this Ticket:
    https://osdn.net//projects/mingw/ticket/37938
RSS feed for this Ticket:
    https://osdn.net/ticket/ticket_rss.php?group_id=3917&tid=37938




More information about the MinGW-Notify mailing list