Re: [msysGit] quick question about __stdcall at run-command.c mingw.c
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Aug 17, 2009, 08:21 UTC
- Message-ID
- <alpine.DEB.1.00.0908171018490.4991@intel-tinevez-2-302>
- In-Reply-To
- <4A890C32.6010507@viscovery.net>
Hi,
On Mon, 17 Aug 2009, Johannes Sixt wrote:
Show 12 quoted lines
> Pat Thoyts schrieb: > > 2009/8/17 Frank Li <lznuaa@gmail.com>: > >> 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.
I think that it does.
But it is _your_ duty to check.
Show 8 quoted lines
> >> 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
Noooo! NO _MSC_VER crap in mingw.c. Really. I am able to repeat that as often as you want me, but I'd prefer not to.
Show 14 quoted lines
> > 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. > > Change the code to > > static unsigned __stdcall run_thread(void *data) > > The documentation explictly says: "The routine at start_address passed to > _beginthreadex must use the __stdcall calling convention...". So __stdcall > it is.
I could not agree more.
Ciao, Dscho