Alexandre Julliard : winegcc: Create a stub main to work around the lack of Unicode support in Mingw.
Alexandre Julliard
julliard at winehq.org
Fri Jun 5 08:56:58 CDT 2009
Module: wine
Branch: master
Commit: 22fef33352c62abf25159831b097c815d0d97471
URL: http://source.winehq.org/git/wine.git/?a=commit;h=22fef33352c62abf25159831b097c815d0d97471
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri Jun 5 14:42:32 2009 +0200
winegcc: Create a stub main to work around the lack of Unicode support in Mingw.
---
tools/winegcc/winegcc.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index 516d2bc..e9c11ed 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -533,6 +533,19 @@ static void add_library( struct options *opts, strarray *lib_dirs, strarray *fil
free(fullname);
}
+/* hack a main or WinMain function to work around Mingw's lack of Unicode support */
+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 <stdlib.h>\n"
+ "extern int wmain(int,wchar_t**);\n"
+ "int main( int argc, char *argv[] )\n{\n"
+ " return wmain( argc, __wargv );\n}\n" );
+ return compile_to_object( opts, main_stub, NULL );
+}
+
static void build(struct options* opts)
{
static const char *stdlibpath[] = { DLLDIR, LIBDIR, "/usr/lib", "/usr/local/lib", "/lib" };
@@ -691,6 +704,9 @@ static void build(struct options* opts)
if (opts->image_base)
strarray_add(link_args, strmake("-Wl,--image-base,%s", opts->image_base));
+ if (opts->unicode_app && !opts->shared)
+ strarray_add(link_args, mingw_unicode_hack(opts));
+
for ( j = 0; j < lib_dirs->size; j++ )
strarray_add(link_args, strmake("-L%s", lib_dirs->base[j]));
More information about the wine-cvs
mailing list