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

This commit is contained in:
Alexandre Julliard 2011-08-01 21:38:56 +02:00
parent 36e73eb3fb
commit b568287eef
5 changed files with 10 additions and 6 deletions

View File

@ -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;

View File

@ -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)

View File

@ -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

View File

@ -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;

View File

@ -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)