1 /* Sample winestub.c file for compiling programs with libwine.so. */
7 extern int PASCAL
WinMain(HINSTANCE32
,HINSTANCE32
,LPSTR
,int);
9 /* external declaration here because we don't want to depend on Wine headers */
11 extern "C" HINSTANCE32
MAIN_WinelibInit( int *argc
, char *argv
[] );
13 extern HINSTANCE32
MAIN_WinelibInit( int *argc
, char *argv
[] );
16 /* Most Windows C/C++ compilers use something like this to */
17 /* access argc and argv globally: */
21 int main( int argc
, char *argv
[] )
23 HINSTANCE32 hInstance
;
27 _ARGV
= (char **)argv
;
29 if (!(hInstance
= MAIN_WinelibInit( &argc
, argv
))) return 0;
31 /* Alloc szCmdParam */
32 for (i
= 1; i
< argc
; i
++) len
+= strlen(argv
[i
]) + 1;
33 lpszCmdParam
= (LPSTR
) xmalloc(len
+ 1);
34 /* Concatenate arguments */
35 if (argc
> 1) strcpy(lpszCmdParam
, argv
[1]);
36 else lpszCmdParam
[0] = '\0';
37 for (i
= 2; i
< argc
; i
++) strcat(strcat(lpszCmdParam
, " "), argv
[i
]);
39 return WinMain (hInstance
, /* hInstance */
40 0, /* hPrevInstance */
41 lpszCmdParam
, /* lpszCmdParam */
42 SW_NORMAL
); /* nCmdShow */