From 76ac103b8022a05c14724ac2edc09b3910954d5a Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 30 Dec 2009 12:32:17 +0100 Subject: [PATCH] winebuild: Add support for generating import libs for 16-bit dlls. --- tools/winebuild/main.c | 1 - tools/winebuild/parser.c | 7 +++++++ tools/winebuild/spec16.c | 8 -------- tools/winebuild/spec32.c | 9 +++++++++ 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/tools/winebuild/main.c b/tools/winebuild/main.c index ae7904d25af..3dd4fea109b 100644 --- a/tools/winebuild/main.c +++ b/tools/winebuild/main.c @@ -657,7 +657,6 @@ int main(int argc, char **argv) break; case MODE_DEF: if (argv[0]) fatal_error( "file argument '%s' not allowed in this mode\n", argv[0] ); - if (spec->type == SPEC_WIN16) fatal_error( "Cannot yet build .def file for 16-bit dlls\n" ); if (!spec_file_name) fatal_error( "missing .spec file\n" ); if (!parse_input_file( spec )) break; BuildDef32File( spec ); diff --git a/tools/winebuild/parser.c b/tools/winebuild/parser.c index d08a1900e5a..f48471c8c50 100644 --- a/tools/winebuild/parser.c +++ b/tools/winebuild/parser.c @@ -744,6 +744,13 @@ void add_16bit_exports( DLLSPEC *spec32, DLLSPEC *spec16 ) int i; ORDDEF *odp; + spec32->file_name = xstrdup( spec16->file_name ); + if (spec16->characteristics & IMAGE_FILE_DLL) + { + spec32->characteristics = IMAGE_FILE_DLL; + spec32->init_func = xstrdup( "__wine_spec_dll_entry" ); + } + /* add an export for the NE module */ odp = add_entry_point( spec32 ); diff --git a/tools/winebuild/spec16.c b/tools/winebuild/spec16.c index abc090d3fbb..c06b4a1932b 100644 --- a/tools/winebuild/spec16.c +++ b/tools/winebuild/spec16.c @@ -860,14 +860,6 @@ void output_spec16_file( DLLSPEC *spec16 ) { DLLSPEC *spec32 = alloc_dll_spec(); - spec32->file_name = xstrdup( spec16->file_name ); - - if (spec16->characteristics & IMAGE_FILE_DLL) - { - spec32->characteristics = IMAGE_FILE_DLL; - spec32->init_func = xstrdup( "__wine_spec_dll_entry" ); - } - resolve_imports( spec16 ); add_16bit_exports( spec32, spec16 ); diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c index c2b11af8474..08703a234df 100644 --- a/tools/winebuild/spec32.c +++ b/tools/winebuild/spec32.c @@ -768,9 +768,17 @@ void output_fake_module( DLLSPEC *spec ) */ void BuildDef32File( DLLSPEC *spec ) { + DLLSPEC *spec32 = NULL; const char *name; int i, total; + if (spec->type == SPEC_WIN16) + { + spec32 = alloc_dll_spec(); + add_16bit_exports( spec32, spec ); + spec = spec32; + } + if (spec_file_name) output( "; File generated automatically from %s; do not edit!\n\n", spec_file_name ); @@ -835,4 +843,5 @@ void BuildDef32File( DLLSPEC *spec ) output( "\n" ); } if (!total) warning( "%s: Import library doesn't export anything\n", spec->file_name ); + if (spec32) free_dll_spec( spec32 ); }