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