Skip to content

Commit

Permalink
Modify mingw_main() workaround to avoid link errors
Browse files Browse the repository at this point in the history
With MinGW's

   gcc.exe (GCC) 3.4.5 (mingw special)
   GNU ld version 2.17.50 20060824

the old define caused link errors:

   git.o: In function `main':
   C:/msysgit/git/git.c:500: undefined reference to `mingw_main'
   collect2: ld returned 1 exit status

The modified define works.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Acked-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Steffen Prohaska authored and Junio C Hamano committed Aug 3, 2008
1 parent 57b0fc4 commit 2253776
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions compat/mingw.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,10 @@ char **env_setenv(char **env, const char *name);
* A replacement of main() that ensures that argv[0] has a path
*/

#define main(c,v) main(int argc, const char **argv) \
#define main(c,v) dummy_decl_mingw_main(); \
static int mingw_main(); \
int main(int argc, const char **argv) \
{ \
static int mingw_main(); \
argv[0] = xstrdup(_pgmptr); \
return mingw_main(argc, argv); \
} \
Expand Down

0 comments on commit 2253776

Please sign in to comment.