Alexandre Julliard : winegcc: Avoid including Windows headers in the Mingw unicode stub.

Alexandre Julliard julliard at winehq.org
Wed Oct 26 12:35:48 CDT 2011


Module: wine
Branch: master
Commit: 5adfd065bbcd56f1c177f85d955b0d50d7ccc90d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5adfd065bbcd56f1c177f85d955b0d50d7ccc90d

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Oct 26 17:38:19 2011 +0200

winegcc: Avoid including Windows headers in the Mingw unicode stub.

---

 tools/winegcc/winegcc.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index adb1873..7d03119 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -648,16 +648,17 @@ static const char *mingw_unicode_hack( struct options *opts )
     char *main_stub = get_temp_file( opts->output_name, ".c" );
 
     create_file( main_stub, 0644,
-                 "#include <stdarg.h>\n"
-                 "#include <windef.h>\n"
-                 "#include <winbase.h>\n"
+                 "typedef unsigned short wchar_t;\n"
+                 "extern void * __stdcall LoadLibraryA(const char *);\n"
+                 "extern void * __stdcall GetProcAddress(void *,const char *);\n"
+                 "extern int wmain( int argc, wchar_t *argv[] );\n\n"
                  "int main( int argc, char *argv[] )\n{\n"
                  "    int wargc;\n"
                  "    wchar_t **wargv, **wenv;\n"
-                 "    HMODULE msvcrt = LoadLibraryA( \"msvcrt.dll\" );\n"
-                 "    void __cdecl (*__wgetmainargs)(int *argc, wchar_t** *wargv, wchar_t** *wenvp, int expand_wildcards,\n"
-                 "                                   int *new_mode) = (void *)GetProcAddress( msvcrt, \"__wgetmainargs\" );\n"
-                 "    __wgetmainargs( &wargc, &wargv, &wenv, 0, NULL );\n"
+                 "    void *msvcrt = LoadLibraryA( \"msvcrt.dll\" );\n"
+                 "    void (*__wgetmainargs)(int *argc, wchar_t** *wargv, wchar_t** *wenvp, int expand_wildcards,\n"
+                 "                           int *new_mode) = GetProcAddress( msvcrt, \"__wgetmainargs\" );\n"
+                 "    __wgetmainargs( &wargc, &wargv, &wenv, 0, 0 );\n"
                  "    return wmain( wargc, wargv );\n}\n" );
     return compile_to_object( opts, main_stub, NULL );
 }




More information about the wine-cvs mailing list