I have a question about widl. tools\widl\header.c function "write_method_macro" fprintf(header, "#define %s_", name); write_name(header,def); fprintf(header, "(p"); for (c=0; c<argc; c++) fprintf(header, ",%c", c+'a'); fprintf(header, ") "); fprintf(header, "(p)->lpVtbl->"); write_name(header, def); fprintf(header, "(p"); for (c=0; c<argc; c++) fprintf(header, ",%c", c+'a'); fprintf(header, ")\n"); This code wrong, because if my function have more then 16 parameters I receive something like this: #define Imyinterface_Open(p,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q (p)->lpVtbl->Open(p,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q) and the compiler gives out a mistake library.h:1296:63: duplicate macro parameter "p" I think that this code should be like this: Variant 1. int p=0; for (c=0; c<argc; c++) { if (p==15) p++; fprintf(header, ",%c", p+'a'); p++; } fprintf(header, ") "); fprintf(header, "(p)->lpVtbl->"); write_name(header, def); fprintf(header, "(p"); p=0; for (c=0; c<argc; c++) { if (p==15) p++; fprintf(header, ",%c", p+'a'); p++; } fprintf(header, ")\n"); or Variant 2. (Without cycles) char str[] = {'p',',','a',',','b',',','c',',','d',',','e',',','f',',','g',',','h',',','i',',','j',',','k',',','l',',','m',',','o',',','q',',','r',',','s',',','t',',','u',',','v',',','w',',','x',',','y',',','z',',',0}; str[2*argc+1] = 0; fprintf(header, "#define %s_", name); write_name(header,def); fprintf(header,"("); fprintf(header,"%s",str); fprintf(header, ") "); fprintf(header, "(p)->lpVtbl->"); write_name(header, def); fprintf(header,"("); fprintf(header,"%s",str); fprintf(header, ")\n"); What do you think about that? ---------------- Sinitsin Ivan
participants (2)
-
Alexandre Julliard -
Ivan Sinitsin