Alexandre Julliard : winebuild: Support the --main-module option for stand-alone 16-bit modules.
Alexandre Julliard
julliard at winehq.org
Wed Mar 4 09:00:59 CST 2009
Module: wine
Branch: master
Commit: a82ce66048cb0168f8ccf82c03dcbd5bf1053d2b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a82ce66048cb0168f8ccf82c03dcbd5bf1053d2b
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Mar 4 14:08:23 2009 +0100
winebuild: Support the --main-module option for stand-alone 16-bit modules.
---
tools/winebuild/build.h | 1 +
tools/winebuild/main.c | 21 ++++++++++-----------
tools/winebuild/parser.c | 10 ++++++++++
tools/winebuild/spec16.c | 6 ++++++
4 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
index 572f465..3818264 100644
--- a/tools/winebuild/build.h
+++ b/tools/winebuild/build.h
@@ -89,6 +89,7 @@ typedef struct
char *file_name; /* file name of the dll */
char *dll_name; /* internal name of the dll */
char *init_func; /* initialization routine */
+ char *main_module; /* main Win32 module for Win16 specs */
SPEC_TYPE type; /* type of dll (Win16/Win32) */
int base; /* ordinal base */
int limit; /* ordinal limit */
diff --git a/tools/winebuild/main.c b/tools/winebuild/main.c
index cab5243..69a1d5f 100644
--- a/tools/winebuild/main.c
+++ b/tools/winebuild/main.c
@@ -82,7 +82,6 @@ char *spec_file_name = NULL;
FILE *output_file = NULL;
const char *output_file_name = NULL;
static const char *output_file_source_name;
-static char *main_module; /* FIXME: to be removed */
char *as_command = NULL;
char *ld_command = NULL;
@@ -360,8 +359,7 @@ static char **parse_options( int argc, char **argv, DLLSPEC *spec )
else force_pointer_size = 8;
break;
case 'M':
- spec->type = SPEC_WIN16;
- main_module = xstrdup( optarg );
+ spec->main_module = xstrdup( optarg );
break;
case 'N':
spec->dll_name = xstrdup( optarg );
@@ -586,24 +584,25 @@ int main(int argc, char **argv)
if (spec->subsystem != IMAGE_SUBSYSTEM_NATIVE)
spec->characteristics |= IMAGE_FILE_DLL;
if (!spec_file_name) fatal_error( "missing .spec file\n" );
+ if (spec->type == SPEC_WIN32 && spec->main_module) /* embedded 16-bit module */
+ {
+ spec->type = SPEC_WIN16;
+ load_resources( argv, spec );
+ if (parse_input_file( spec )) BuildSpec16File( spec );
+ break;
+ }
/* fall through */
case MODE_EXE:
load_resources( argv, spec );
load_import_libs( argv );
if (spec_file_name && !parse_input_file( spec )) break;
+ read_undef_symbols( spec, argv );
switch (spec->type)
{
case SPEC_WIN16:
- if (!main_module)
- {
- read_undef_symbols( spec, argv );
- output_spec16_file( spec );
- }
- else
- BuildSpec16File( spec );
+ output_spec16_file( spec );
break;
case SPEC_WIN32:
- read_undef_symbols( spec, argv );
BuildSpec32File( spec );
break;
default: assert(0);
diff --git a/tools/winebuild/parser.c b/tools/winebuild/parser.c
index dd79a1c..fc14ad3 100644
--- a/tools/winebuild/parser.c
+++ b/tools/winebuild/parser.c
@@ -743,6 +743,16 @@ void add_16bit_exports( DLLSPEC *spec32, DLLSPEC *spec16 )
odp->ordinal = 1;
odp->link_name = xstrdup( ".L__wine_spec_dos_header" );
+ if (spec16->main_module)
+ {
+ odp = add_entry_point( spec32 );
+ odp->type = TYPE_EXTERN;
+ odp->name = xstrdup( "__wine_spec_main_module" );
+ odp->lineno = 0;
+ odp->ordinal = 2;
+ odp->link_name = xstrdup( ".L__wine_spec_main_module" );
+ }
+
assign_names( spec32 );
assign_ordinals( spec32 );
}
diff --git a/tools/winebuild/spec16.c b/tools/winebuild/spec16.c
index 1465d2c..7c6fc45 100644
--- a/tools/winebuild/spec16.c
+++ b/tools/winebuild/spec16.c
@@ -875,6 +875,12 @@ void output_spec16_file( DLLSPEC *spec16 )
output_exports( spec32 );
output_imports( spec16 );
output_resources( spec16 );
+ if (spec16->main_module)
+ {
+ output( "\n\t%s\n", get_asm_string_section() );
+ output( ".L__wine_spec_main_module:\n" );
+ output( "\t%s \"%s\"\n", get_asm_string_keyword(), spec16->main_module );
+ }
output_gnu_stack_note();
free_dll_spec( spec32 );
}
More information about the wine-cvs
mailing list