1 /* Sample winestub.c file for compiling programs with libwine.so. */
7 extern int PASCAL
WinMain(HINSTANCE32
,HINSTANCE32
,LPSTR
,int);
8 extern BOOL32
MAIN_WinelibInit( int *argc
, char *argv
[] );
9 extern void TASK_Reschedule(void);
11 /* Most Windows C/C++ compilers use something like this to */
12 /* access argc and argv globally: */
16 int main( int argc
, char *argv
[] )
18 HINSTANCE32 hInstance
;
22 _ARGV
= (char **)argv
;
24 if (!MAIN_WinelibInit( &argc
, argv
)) return 0;
26 /* Alloc szCmdParam */
27 for (i
= 1; i
< argc
; i
++) len
+= strlen(argv
[i
]) + 1;
28 lpszCmdParam
= (LPSTR
) xmalloc(len
+ 1);
29 /* Concatenate arguments */
30 if (argc
> 1) strcpy(lpszCmdParam
, argv
[1]);
31 else lpszCmdParam
[0] = '\0';
32 for (i
= 2; i
< argc
; i
++) strcat(strcat(lpszCmdParam
, " "), argv
[i
]);
34 hInstance
= WinExec32( *argv
, SW_SHOWNORMAL
);
38 return WinMain (hInstance
, /* hInstance */
39 0, /* hPrevInstance */
40 lpszCmdParam
, /* lpszCmdParam */
41 SW_NORMAL
); /* nCmdShow */