1 /* Sample winestub.c file for compiling programs with libwine.so. */
8 #include "debugtools.h"
10 extern int PASCAL
WinMain(HINSTANCE
,HINSTANCE
,LPSTR
,int);
12 /* external declaration here because we don't want to depend on Wine headers */
14 extern "C" HINSTANCE
MAIN_WinelibInit( int *argc
, char *argv
[] );
16 extern HINSTANCE
MAIN_WinelibInit( int *argc
, char *argv
[] );
19 /* Most Windows C/C++ compilers use something like this to */
20 /* access argc and argv globally: */
24 int main( int argc
, char *argv
[] )
30 _ARGV
= (char **)argv
;
32 if (!(hInstance
= MAIN_WinelibInit( &argc
, argv
))) return 0;
34 /* Alloc szCmdParam */
35 for (i
= 1; i
< argc
; i
++) len
+= strlen(argv
[i
]) + 1;
36 lpszCmdParam
= (LPSTR
) malloc(len
+ 1);
37 if(lpszCmdParam
== NULL
) {
38 MESSAGE("Not enough memory to store command parameters!");
41 /* Concatenate arguments */
42 if (argc
> 1) strcpy(lpszCmdParam
, argv
[1]);
43 else lpszCmdParam
[0] = '\0';
44 for (i
= 2; i
< argc
; i
++) strcat(strcat(lpszCmdParam
, " "), argv
[i
]);
46 retv
= WinMain (hInstance
, /* hInstance */
47 0, /* hPrevInstance */
48 lpszCmdParam
, /* lpszCmdParam */
49 SW_NORMAL
); /* nCmdShow */