git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/3] MSVC: fix stat definition hell

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Sep 11, 2013, 00:35 UTC
Message-ID
<CAPig+cTU6iuv84QH+Y+u4UJ9b-aHQo7zzTv6umnG1tZ9v7+nvw@mail.gmail.com>
In-Reply-To
<522FA9E1.7010705@gmail.com>
On Tue, Sep 10, 2013 at 7:23 PM, Karsten Blees <karsten.blees@gmail.com> wrote:
> In msvc.h, there's a couple of stat related functions defined diffently
s/diffently/differently/
Show 27 quoted lines
> from mingw.h. When we remove these definitions, the only problem we get is
> "warning C4005: '_stati64' : macro redefinition" for this line in mingw.h:
>
> #define _stati64(x,y) mingw_stat(x,y)
>
> The reason is that as of MSVCR80.dll (distributed with MSVC 2005), the
> original _stati64 family of functions was renamed to _stat32i64, and the
> former function names became macros (pointing to the appropriate function
> based on the definition of _USE_32BIT_TIME_T).
>
> Defining _stati64 works on MinGW because MinGW by default compiles against
> the MSVCRT.DLL that is part of Windows (i.e. _stati64 is a function rather
> than a macro).
>
> Note: MinGW *can* compile for newer MSVC runtime versions, and MSVC
> apparently can also compile for the Windows MSVCRT.DLL via the DDK (see
> http://www.syndicateofideas.com/posts/fighting-the-msvcrt-dll-hell ).
>
> Remove the stat definitions from msvc.h, as they are not compiler related.
>
> In mingw.h, determine the runtime version in use from the definitions of
> _stati64 and _USE_32BIT_TIME_T, and define stat() accordingly.
>
> This also fixes that stat() in MSVC builds still resolves to mingw_lstat()
> instead of mingw_stat().
>
> Signed-off-by: Karsten Blees <blees@dcon.de>
Previous: Karsten BleesNext: Sebastian Schuberth
Message 5 of 9 in “Fix MSVC compile errors and cleanup stat definitions”
  1. 0/3 Fix MSVC compile errors and cleanup stat definitionsKarsten Blees, Sep 10, 2013
  2. 1/3 MSVC: fix compile errors due to missing libintl.hKarsten Blees, Sep 10, 2013
  3. 2/3 MSVC: fix compile errors due to macro redefinitionsKarsten Blees, Sep 10, 2013
  4. 3/3 MSVC: fix stat definition hellKarsten Blees, Sep 10, 2013
  5. Eric SunshineSep 11, 2013
  6. Sebastian SchuberthSep 11, 2013
  7. Junio C HamanoSep 11, 2013
  8. Sebastian SchuberthSep 11, 2013
  9. Junio C HamanoSep 11, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.