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

Re: [PATCH 04/14] Set _O_BINARY as default fmode for both MinGW and MSVC

From
Alexey Borzenkov <snaury@gmail.com>
Date
Sep 15, 2009, 18:40 UTC
Message-ID
<e2480c70909151140i26a8e748wf978145724d3fd55@mail.gmail.com>
In-Reply-To
<badc5d24387c28c752a45f75e8aec6bce64f81fe.1253021728.git.mstormo@gmail.com>
On Tue, Sep 15, 2009 at 5:44 PM, Marius Storm-Olsen <mstormo@gmail.com> wrote:
> +extern int _fmode;

Is it really needed? I might be wrong, but I thought _fmode needed a more complex declaration, at least on mingw, for which you are supposed to include stdlib.h. For example, for mingw, in stdlib.h, it is declared this way:

#if !defined (__DECLSPEC_SUPPORTED) || defined (__IN_MINGW_RUNTIME)

#ifdef __MSVCRT__ extern int* _imp___fmode; #define _fmode (*_imp___fmode) #else /* CRTDLL */ extern int* _imp___fmode_dll; #define _fmode (*_imp___fmode_dll) #endif

#else /* __DECLSPEC_SUPPORTED */

#ifdef __MSVCRT__ __MINGW_IMPORT int _fmode; #else /* ! __MSVCRT__ */ __MINGW_IMPORT int _fmode_dll; #define _fmode _fmode_dll #endif /* ! __MSVCRT__ */

#endif /* __DECLSPEC_SUPPORTED */

As you can see it is a little more complex than a simple extern (e.g. it uses __declspec(dllimport) when it is supported, and a bit of manual dereferencing otherwise). So maybe you would just include stdlib.h and use definition from there?

Previous: Marius Storm-OlsenNext: Alexey Borzenkov
Message 18 of 21 in “Build Git with MSVC”
  1. 00/14 Build Git with MSVCMarius Storm-Olsen, Sep 15, 2009
  2. 01/14 Avoid declaration after statementMarius Storm-Olsen, Sep 15, 2009
  3. 02/14 Add define guards to compat/win32.hMarius Storm-Olsen, Sep 15, 2009
  4. 03/14 Change regerror() declaration from K&R style to ANSI C (C89)Marius Storm-Olsen, Sep 15, 2009
  5. 04/14 Set _O_BINARY as default fmode for both MinGW and MSVCMarius Storm-Olsen, Sep 15, 2009
  6. 05/14 Fix __stdcall placement and function prototypeMarius Storm-Olsen, Sep 15, 2009
  7. 06/14 Test for WIN32 instead of __MINGW32_Marius Storm-Olsen, Sep 15, 2009
  8. 07/14 Add empty header files for MSVC portMarius Storm-Olsen, Sep 15, 2009
  9. 08/14 Add MinGW header files to build git with MSVCMarius Storm-Olsen, Sep 15, 2009
  10. 09/14 Add platform files for MSVC portingMarius Storm-Olsen, Sep 15, 2009
  11. 10/14 Make usage of windows.h lean and meanMarius Storm-Olsen, Sep 15, 2009
  12. 11/14 Define strncasecmp and ftruncate for MSVCMarius Storm-Olsen, Sep 15, 2009
  13. 12/14 Add MSVC to MakefileMarius Storm-Olsen, Sep 15, 2009
  14. 13/14 Add README for MSVC buildMarius Storm-Olsen, Sep 15, 2009
  15. 14/14 Add scripts to generate projects for other buildsystems (MSVC vcproj, QMake)Marius Storm-Olsen, Sep 15, 2009
  16. Thiago FarinaSep 16, 2009
  17. Marius Storm-OlsenSep 16, 2009
  18. Alexey BorzenkovSep 15, 2009
  19. Alexey BorzenkovSep 15, 2009
  20. Alexey BorzenkovSep 15, 2009
  21. Marius Storm-OlsenSep 15, 2009

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.