summaryrefslogtreecommitdiff
path: root/compat/mingw.h
diff options
context:
space:
mode:
Diffstat (limited to 'compat/mingw.h')
-rw-r--r--compat/mingw.h24
1 files changed, 13 insertions, 11 deletions
diff --git a/compat/mingw.h b/compat/mingw.h
index 593bdbf..a03e40e 100644
--- a/compat/mingw.h
+++ b/compat/mingw.h
@@ -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;
@@ -562,18 +564,18 @@ 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