From b568287eef4a5cceaf27568bab4b2576749489ae Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Mon, 1 Aug 2011 21:38:56 +0200 Subject: [PATCH] widl: Add support for generating typelibs directly in resource format. --- tools/widl/parser.y | 1 - tools/widl/typelib.c | 2 -- tools/widl/widl.man.in | 4 +++- tools/widl/widltypes.h | 1 - tools/widl/write_msft.c | 8 +++++++- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/tools/widl/parser.y b/tools/widl/parser.y index d4852d13203..5286977529c 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -1725,7 +1725,6 @@ static typelib_t *make_library(const char *name, const attr_list_t *attrs) { typelib_t *typelib = xmalloc(sizeof(*typelib)); typelib->name = xstrdup(name); - typelib->filename = NULL; typelib->attrs = attrs; list_init( &typelib->importlibs ); return typelib; diff --git a/tools/widl/typelib.c b/tools/widl/typelib.c index 9c24f152629..e3fc0b97c41 100644 --- a/tools/widl/typelib.c +++ b/tools/widl/typelib.c @@ -255,9 +255,7 @@ unsigned short get_type_vt(type_t *t) void start_typelib(typelib_t *typelib_type) { if (!do_typelib) return; - typelib = typelib_type; - typelib->filename = xstrdup(typelib_name); } void end_typelib(void) diff --git a/tools/widl/widl.man.in b/tools/widl/widl.man.in index 4988ee94500..f74328b73ee 100644 --- a/tools/widl/widl.man.in +++ b/tools/widl/widl.man.in @@ -48,7 +48,9 @@ Use old naming conventions. .PP .B Type library options: .IP \fB-t\fR -Generate a type library. The default output filename is \fIinfile\fB.tlb\fR. +Generate a type library. The default output filename is +\fIinfile\fB.tlb\fR. If the output file name ends in \fB.res\fR, a +binary resource file containing the type library is generated instead. .IP "\fB-m32, -m64\fR" Generate a Win32, respectively Win64, type library. .PP diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h index 64c94e5a46c..d1066bd23e8 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h @@ -494,7 +494,6 @@ struct _importlib_t { struct _typelib_t { char *name; - char *filename; const attr_list_t *attrs; struct list importlibs; statement_list_t *stmts; diff --git a/tools/widl/write_msft.c b/tools/widl/write_msft.c index 33b99e7124c..66da2866cf8 100644 --- a/tools/widl/write_msft.c +++ b/tools/widl/write_msft.c @@ -2542,7 +2542,13 @@ static void save_all_changes(msft_typelib_t *typelib) ctl2_write_segment( typelib, MSFT_SEG_CUSTDATAGUID ); ctl2_write_typeinfos(typelib); - flush_output_buffer( typelib->typelib->filename ); + + if (strendswith( typelib_name, ".res" )) /* create a binary resource file */ + { + add_output_to_resources( "TYPELIB", "#1" ); + flush_output_resources( typelib_name ); + } + else flush_output_buffer( typelib_name ); } int create_msft_typelib(typelib_t *typelib)