]> git.saurik.com Git - wxWidgets.git/blob - src/msw/winestub.c
Hack compilation using the latest MinGW release.
[wxWidgets.git] / src / msw / winestub.c
1 /****************************************************************************
2 * Name: src/msw/winestub.cpp
3 * Purpose: wxWINE module mapping main() to WinMain()
4 * Author: Robert Roebling
5 * Created: 04/01/98
6 * Copyright: (c) Robert Roebling
7 * Licence: wxWindows licence
8 *****************************************************************************/
9
10 #include <string.h>
11 #include "winuser.h"
12 #include "xmalloc.h"
13
14 extern int PASCAL WinMain( HINSTANCE, HINSTANCE, LPSTR, int );
15 extern HINSTANCE MAIN_WinelibInit( int *argc, char *argv[] );
16
17 /* Most Windows C/C++ compilers use something like this to */
18 /* access argc and argv globally: */
19 int _ARGC;
20 char **_ARGV;
21
22 int main( int argc, char *argv [] )
23 {
24 HINSTANCE hInstance;
25 LPSTR lpszCmdParam;
26 int i, len = 0;
27 _ARGC = argc;
28 _ARGV = (char **)argv;
29
30 if (!(hInstance = MAIN_WinelibInit( &argc, argv ))) return 0;
31
32 /* Alloc szCmdParam */
33 for (i = 1; i < argc; i++) len += strlen(argv[i]) + 1;
34 lpszCmdParam = (LPSTR) xmalloc(len + 1);
35 /* Concatenate arguments */
36 if (argc > 1) strcpy(lpszCmdParam, argv[1]);
37 else lpszCmdParam[0] = '\0';
38 for (i = 2; i < argc; i++) strcat(strcat(lpszCmdParam, " "), argv[i]);
39
40 return WinMain (hInstance, /* hInstance */
41 0, /* hPrevInstance */
42 lpszCmdParam, /* lpszCmdParam */
43 SW_NORMAL); /* nCmdShow */
44 }