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 */
10 extern HINSTANCE32
MAIN_WinelibInit( int *argc
, char *argv
[] );
12 /* Most Windows C/C++ compilers use something like this to */
13 /* access argc and argv globally: */
17 int main( int argc
, char *argv
[] )
19 HINSTANCE32 hInstance
;
23 _ARGV
= (char **)argv
;
25 if (!(hInstance
= MAIN_WinelibInit( &argc
, argv
))) return 0;
27 /* Alloc szCmdParam */
28 for (i
= 1; i
< argc
; i
++) len
+= strlen(argv
[i
]) + 1;
29 lpszCmdParam
= (LPSTR
) xmalloc(len
+ 1);
30 /* Concatenate arguments */
31 if (argc
> 1) strcpy(lpszCmdParam
, argv
[1]);
32 else lpszCmdParam
[0] = '\0';
33 for (i
= 2; i
< argc
; i
++) strcat(strcat(lpszCmdParam
, " "), argv
[i
]);
35 return WinMain (hInstance
, /* hInstance */
36 0, /* hPrevInstance */
37 lpszCmdParam
, /* lpszCmdParam */
38 SW_NORMAL
); /* nCmdShow */