[PATCH v2] widl: Add option to not generate RPC includes.
Jacek Caban
jacek at codeweavers.com
Thu Nov 15 12:06:16 CST 2018
Hi Józef,
On 11/15/18 4:36 PM, Józef Kucia wrote:
> This makes it easier to use header files generated by widl without
> Windows headers. In particular, headers generated with --no-rpc-includes
> do not need rpc.h and rpcndr.h header files.
>
> Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
> ---
>
> This change is mainly for vkd3d. Currently, we use an ugly hack to strip
> RPC includes from the generated header files.
>
> Version 2: Rebased.
>
> ---
> tools/widl/header.c | 13 ++++++++-----
> tools/widl/widl.c | 7 +++++++
> tools/widl/widl.h | 1 +
> tools/widl/widl.man.in | 2 ++
> 4 files changed, 18 insertions(+), 5 deletions(-)
>
> diff --git a/tools/widl/header.c b/tools/widl/header.c
> index defc7f850371..212c20a90148 100644
> --- a/tools/widl/header.c
> +++ b/tools/widl/header.c
> @@ -1784,12 +1784,15 @@ void write_header(const statement_list_t *stmts)
> }
> fprintf(header, "/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n\n", PACKAGE_VERSION, input_name);
>
> - fprintf(header, "#ifndef __REQUIRED_RPCNDR_H_VERSION__\n");
> - fprintf(header, "#define __REQUIRED_RPCNDR_H_VERSION__ 475\n");
> - fprintf(header, "#endif\n\n");
> + if (!no_rpc_includes) {
> + fprintf(header, "#ifndef __REQUIRED_RPCNDR_H_VERSION__\n");
> + fprintf(header, "#define __REQUIRED_RPCNDR_H_VERSION__ 475\n");
> + fprintf(header, "#endif\n\n");
> +
> + fprintf(header, "#include <rpc.h>\n" );
> + fprintf(header, "#include <rpcndr.h>\n" );
> + }
>
> - fprintf(header, "#include <rpc.h>\n" );
> - fprintf(header, "#include <rpcndr.h>\n" );
> if (!for_each_serializable(stmts, NULL, serializable_exists))
> fprintf(header, "#include <midles.h>\n" );
> fprintf(header, "\n" );
It probably doesn't matter much in practice, but midles.h should
probably be treated the same way as other RPC includes.
Also could we just guard RPC includes with #ifdef _WIN32 instead? This
wouldn't need a new command line option and would just make all
generated headers usable on non-windows builds (at least to the same
extend as --no-rpc-includes does). You could then use identical header
in Wine and vkd3d.
Jacek
More information about the wine-devel
mailing list