Alexandre Julliard : widl: Add support for generating typelibs directly in resource format.

Alexandre Julliard julliard at winehq.org
Tue Aug 2 14:18:24 CDT 2011


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Aug  1 21:38:56 2011 +0200

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 d4852d1..5286977 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 9c24f15..e3fc0b9 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 4988ee9..f74328b 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 64c94e5..d1066bd 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 33b99e7..66da286 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)




More information about the wine-cvs mailing list