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

Re: [msysGit] quick question about __stdcall at run-command.c mingw.c

From
Pat Thoyts <patthoyts@googlemail.com>
Date
Aug 17, 2009, 00:03 UTC
Message-ID
<a5b261830908161703l2296448l698d07d01ae8a6d3@mail.gmail.com>
In-Reply-To
<1976ea660908161619x5182762sade051f24fef13db@mail.gmail.com>
2009/8/17 Frank Li <lznuaa@gmail.com>:
Show 21 quoted lines
>
> I am tring to clear VC build patch.
>
> I found __stdcall position break MSVC build.
>
> static __stdcall unsigned run_thread(void *data)
>
> MSVC require __stdcall should be between return type and function name.
> like
> static unsigned __stdcall run_thread(void *data)
>
> I think msys gcc should support MSVC format.
>
> Should I directly change to MSVC format or add _MSC_VER marcro like
>
> #if defined(__MINGW32__)
> static __stdcall unsigned run_thread(void *data)
> #elif defined(_MSC_VER) /*MSVC must put __stdcall between return value
> and function*/
> static unsigned __stdcall run_thread(void *data)
> #endif

The win32 api prototype used for thread entry functions is declared as a DWORD (WINAPI *LPTHREAD_START_ROUTINE)(LPVOID) type in the mingw headers and WINAPI as #define WINAPI __stdcall. This is true for the MSVC headers as well. So gcc and msvc are happy using the same definition for such a function and just "static unsigned long WINAPI run_thread(void *)" might well be sensible.

Previous: Frank LiNext: Johannes Sixt
Message 2 of 6 in “quick question about __stdcall at run-command.c mingw.c”
  1. Frank LiAug 16, 2009
  2. Pat ThoytsAug 17, 2009
  3. Johannes SixtAug 17, 2009
  4. Johannes SchindelinAug 17, 2009
  5. Johannes SixtAug 17, 2009
  6. Johannes SchindelinAug 17, 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.