[PATCH] tools/widl/header.c: Add a way to declare interface data members.

Michael Stefaniuc mstefani at redhat.com
Sat Nov 10 14:30:29 CST 2012


You can't do that as the COM standard specifies also the ABI.
A COM interface is a pointer to a virtual table; it is *not* a struct.
That's just an implementation detail in C.

On 11/10/2012 08:48 PM, max at mtew.isa-geek.net wrote:
> From: Max TenEyck Woodbury <max+git at mtew.isa-geek.net>
> 
> ---
>  tools/widl/header.c |   14 ++++++++++++++
>  1 files changed, 14 insertions(+), 0 deletions(-)
> 
> diff --git a/tools/widl/header.c b/tools/widl/header.c
> index 2f275c7..965dcbc 100644
> --- a/tools/widl/header.c
> +++ b/tools/widl/header.c
> @@ -1159,6 +1159,17 @@ static void write_com_interface_start(FILE *header, const type_t *iface)
>    fprintf(header,"#define __%s_%sINTERFACE_DEFINED__\n\n", iface->name, dispinterface ? "DISP" : "");
>  }
>  
> +static void write_interface_data_macro(FILE *header, const type_t *iface)
> +{
> +
> +  if (type_iface_get_inherit(iface))
> +    write_interface_data_macro(header, type_iface_get_inherit(iface));
> +
> +  fprintf(header, "#ifdef %s_IFACE_DATA\n", iface->name);
> +  fprintf(header, "    %s_IFACE_DATA\n", iface->name);
> +  fprintf(header, "#endif /* defined %s */\n", iface->name);
> +}
> +
>  static void write_com_interface_end(FILE *header, type_t *iface)
>  {
>    int dispinterface = is_attr(iface->attrs, ATTR_DISPINTERFACE);
> @@ -1214,6 +1225,9 @@ static void write_com_interface_end(FILE *header, type_t *iface)
>    fprintf(header, "} %sVtbl;\n", iface->name);
>    fprintf(header, "interface %s {\n", iface->name);
>    fprintf(header, "    CONST_VTBL %sVtbl* lpVtbl;\n", iface->name);
> +
> +  write_interface_data_macro(header, iface);
> +
>    fprintf(header, "};\n");
>    fprintf(header, "\n");
>    fprintf(header, "#ifdef COBJMACROS\n");


bye
	michael



More information about the wine-devel mailing list