diff options
Diffstat (limited to 'compat/mingw.h')
-rw-r--r-- | compat/mingw.h | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/compat/mingw.h b/compat/mingw.h index 593bdbffe6..9ad204c57c 100644 --- a/compat/mingw.h +++ b/compat/mingw.h @@ -11,7 +11,7 @@ typedef _sigset_t sigset_t; #undef _POSIX_THREAD_SAFE_FUNCTIONS #endif -extern int mingw_core_config(const char *var, const char *value, void *cb); +int mingw_core_config(const char *var, const char *value, void *cb); #define platform_core_config mingw_core_config /* @@ -352,11 +352,13 @@ static inline int getrlimit(int resource, struct rlimit *rlp) #ifndef __MINGW64_VERSION_MAJOR #define off_t off64_t #define lseek _lseeki64 +#ifndef _MSC_VER struct timespec { time_t tv_sec; long tv_nsec; }; #endif +#endif struct mingw_stat { _dev_t st_dev; @@ -441,7 +443,7 @@ static inline void convert_slashes(char *path) *path = '/'; } #define PATH_SEP ';' -extern char *mingw_query_user_email(void); +char *mingw_query_user_email(void); #define query_user_email mingw_query_user_email #if !defined(__MINGW64_VERSION_MAJOR) && (!defined(_MSC_VER) || _MSC_VER < 1800) #define PRIuMAX "I64u" @@ -562,20 +564,20 @@ int xwcstoutf(char *utf, const wchar_t *wcs, size_t utflen); extern CRITICAL_SECTION pinfo_cs; /* - * A replacement of main() that adds win32 specific initialization. + * Git, like most portable C applications, implements a main() function. On + * Windows, this main() function would receive parameters encoded in the + * current locale, but Git for Windows would prefer UTF-8 encoded parameters. + * + * To make that happen, we still declare main() here, and then declare and + * implement wmain() (which is the Unicode variant of main()) and compile with + * -municode. This wmain() function reencodes the parameters from UTF-16 to + * UTF-8 format, sets up a couple of other things as required on Windows, and + * then hands off to the main() function. */ - -void mingw_startup(void); -#define main(c,v) dummy_decl_mingw_main(void); \ -static int mingw_main(c,v); \ -int main(int argc, const char **argv) \ -{ \ - mingw_startup(); \ - return mingw_main(__argc, (void *)__argv); \ -} \ -static int mingw_main(c,v) +int wmain(int argc, const wchar_t **w_argv); +int main(int argc, const char **argv); /* * Used by Pthread API implementation for Windows */ -extern int err_win_to_posix(DWORD winerr); +int err_win_to_posix(DWORD winerr); |