RE: Forward Declaration using IDL Attributes

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

juan_at_agleader.com
Date: 02/10/05


Date: Thu, 10 Feb 2005 09:59:03 -0800

I actually figured out my own question. If you add "[export]" in from the
interface forward declaration, the idl compiler will work;

[export] __interface IObjectAColl;

Thanks anyway,
Juan Foegen

"juan@agleader.com" wrote:

> I have created an ATL COM component using IDL Attributes. The component has
> worked fine, but now I have a new requirement where objectA can contain a
> collection of objectAs. This causes a circular dependency which I satisfied
> in the compiler by using forward declarations for the object collection and
> its interface
>
> __interface IObjectAColl;
> class ObjectAColl;
>
> __interface IObjectA
> {
> [propget, id(24), HRESULT ObjectAColl([out, retval] IObjectAColl** pVal);
> }
>
> The C++ compile and link work fine, but the MIDL compiler gives me the
> following error:
>
> error MIDL2025 : syntax error : expecting a type specification near
> "IObjectAColl"
>
> I tried adding a forward declaration for the Midl compiler, but I must not
> be doing it correctly
>
> #ifdef __midl
> interface IObjectAColl;
> #endif
>
> Does anybody have any insight on my error or how I can do a forward
> declaration here to satisfy MIDL?
>
> Thanks,
> Juan Foegen



Relevant Pages

  • Re: object system...
    ... type declaration and pulling the latter with it. ... produces the result, the type or interface. ... you prevent the compiler to do it for you. ... And with most of optimizations the ...
    (comp.object)
  • Re: Whats with "typedef interface ID3DXLine ID3DXLine;" in d3dx9core.h?
    ... The typedef serves as a forward declaration, that is, it specifies the existence of such an interface before it is actually defined. ... This allows the line that follows it, which defines a type LPD3DXLINE as a pointer to that interface, even though the interface class has not been defined yet. ... Without the forward declaration "class B;" there would be a kind of "which came first, the chicken or the egg" problem, because the compiler would not know of the existance of the B class when it attempts to compile the A class and encounters a pointer to a type "B". ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: implementing roles in OOP......
    ... > relationship instantiation from relationship navigation. ... > It's not an interface issue; ... > The Client provides the Visitor reference when it invokes ... autognerate the declaration for me. ...
    (comp.object)
  • Re: Question about 6.2.4 of C99
    ... compilers to reuse memory in some cases, ... muddying up the semantics and/or making the programmer work harder. ... than it would be if the declaration created and really ... I understand why the VLA rules are the way they are. ...
    (comp.std.c)
  • Re: Question about 6.2.4 of C99
    ... compilers to reuse memory in some cases, ... muddying up the semantics and/or making the programmer work harder. ... the same way it does for VLAs? ... I write an intra-block declaration and every time I read one I ...
    (comp.std.c)