diff --git a/tools/widl/header.h b/tools/widl/header.h index 6d056db2df5..bf5f426c6d7 100644 --- a/tools/widl/header.h +++ b/tools/widl/header.h @@ -47,6 +47,7 @@ extern int need_proxy(const type_t *iface); extern int need_inline_stubs(const type_t *iface); extern int need_stub_files(const statement_list_t *stmts); extern int need_proxy_file(const statement_list_t *stmts); +extern int need_proxy_delegation(const statement_list_t *stmts); extern int need_inline_stubs_file(const statement_list_t *stmts); extern const var_t *is_callas(const attr_list_t *list); extern void write_args(FILE *h, const var_list_t *arg, const char *name, int obj, int do_indent); diff --git a/tools/widl/proxy.c b/tools/widl/proxy.c index e0690e49daa..0c0d7ceee5b 100644 --- a/tools/widl/proxy.c +++ b/tools/widl/proxy.c @@ -778,7 +778,12 @@ int need_stub(const type_t *iface) int need_proxy_file(const statement_list_t *stmts) { - return does_any_iface(stmts, need_proxy); + return does_any_iface(stmts, need_proxy); +} + +int need_proxy_delegation(const statement_list_t *stmts) +{ + return does_any_iface(stmts, need_delegation); } int need_inline_stubs(const type_t *iface) diff --git a/tools/widl/widl.c b/tools/widl/widl.c index fc3d0d97862..8186b7748cb 100644 --- a/tools/widl/widl.c +++ b/tools/widl/widl.c @@ -340,7 +340,7 @@ static void free_filename_nodes(struct list *list) } } -static void write_dlldata_list(struct list *filenames) +static void write_dlldata_list(struct list *filenames, int define_proxy_delegation) { FILE *dlldata; filename_node_t *node; @@ -351,6 +351,8 @@ static void write_dlldata_list(struct list *filenames) fprintf(dlldata, "/*** Autogenerated by WIDL %s ", PACKAGE_VERSION); fprintf(dlldata, "- Do not edit ***/\n\n"); + if (define_proxy_delegation) + fprintf(dlldata, "#define PROXY_DELEGATION\n"); fprintf(dlldata, "#include \n"); fprintf(dlldata, "#include \n\n"); start_cplusplus_guard(dlldata); @@ -380,15 +382,19 @@ static char *eat_space(char *s) void write_dlldata(const statement_list_t *stmts) { struct list filenames = LIST_INIT(filenames); + int define_proxy_delegation = 0; filename_node_t *node; FILE *dlldata; if (!do_dlldata || !need_proxy_file(stmts)) return; + define_proxy_delegation = need_proxy_delegation(stmts); + dlldata = fopen(dlldata_name, "r"); if (dlldata) { static char marker[] = "REFERENCE_PROXY_FILE"; + static const char delegation_define[] = "#define PROXY_DELEGATION"; char *line = NULL; size_t len = 0; @@ -409,6 +415,8 @@ void write_dlldata(const statement_list_t *stmts) *end = '\0'; if (start < end) add_filename_node(&filenames, start); + }else if (!define_proxy_delegation && strncmp(start, delegation_define, sizeof(delegation_define)-1)) { + define_proxy_delegation = 1; } } @@ -427,7 +435,7 @@ void write_dlldata(const statement_list_t *stmts) } add_filename_node(&filenames, proxy_token); - write_dlldata_list(&filenames); + write_dlldata_list(&filenames, define_proxy_delegation); free_filename_nodes(&filenames); } @@ -676,7 +684,7 @@ int main(int argc,char *argv[]) for ( ; optind < argc; ++optind) add_filename_node(&filenames, argv[optind]); - write_dlldata_list(&filenames); + write_dlldata_list(&filenames, 0 /* FIXME */ ); free_filename_nodes(&filenames); return 0; }