lør, 2003-03-15 kl. 13:35 skrev Jon Griffiths:
Hi,
--- Ove Kaaven ovek@arcticnet.no wrote:
Could you explain the reason behind the last line, "Don't dump full struct/enum definitions in prototypes", since this shouldn't happen in any case.
The following idl file, "foo.idl", cut down from my oleidl.idl for example purposes:
import "objidl.idl";
interface IOleClientSite; interface IOleObject;
typedef LPCRECT LPCBORDERWIDTHS;
[ object, uuid(00000112-0000-0000-C000-000000000046) ] interface IOleObject : IUnknown { typedef IOleObject* LPOLEOBJECT;
HRESULT DoVerb( [in] LONG iVerb, [in] struct tagMSG* lpmsg, [in] IOleClientSite* pActiveSite, [in] LONG lindex, [in] HWND hwndParent, [in] LPCRECT lprcPosRect); }
Produces as its output when run with -b -h:
struct IOleObject: IUnknown { virtual HRESULT CALLBACK DoVerb( LONG iVerb, struct tagMSG { HWND hwnd; UINT message; WPARAM wParam; LPARAM lParam; DWORD time; POINT pt; }* lpmsg, IOleClientSite* pActiveSite, LONG lindex, HWND hwndParent, LPCRECT lprcPosRect) = 0;
} ICOM_COM_INTERFACE_ATTRIBUTE;
Oh I see now... struct tagMSG is defined in an imported idl file so it won't be written out while processing ocidl, and thus t->written remains FALSE even though it's properly defined. The best way to solve this would still be to ensure that t->written is TRUE, by changing the parser.y line
if (!parse_only) write_typedef($$, $4);
into something that will still set the "written" field of the type (and its embedded structures) even if parse_only is true (and similarly with the enumdefs, structdefs, uniondefs, and interfacedefs, probably). A new parameter to write_type/write_typedef which inhibits writing anything to the header but still sets "written", for example... would that work?