how to use an interface belong to another library in idl file
-
I have an interface, I1 declared in library A, I use I1 in library B by writing code like ///////////////// begin ///////////////////// import "A.idl" [ object, uuid(...), ...... ] interface I2 : IDispatch{ [propget, id(1), helpstring("...")] HRESULT I1([out, retval] I1** prop); }; ///////////////// end /////////////////// Both project A and project B built all right. Now I import A.tlb and B.tlb in project C, and write following code ///////////////// begin ///////////////////// CComPtr < I1> spI1; ///////////////// end /////////////////// compil failed with message error C2872 : "I1" : ambiguous symbol . While what I hope is only one I1, but now there are two. How to resolve this problem?
-
I have an interface, I1 declared in library A, I use I1 in library B by writing code like ///////////////// begin ///////////////////// import "A.idl" [ object, uuid(...), ...... ] interface I2 : IDispatch{ [propget, id(1), helpstring("...")] HRESULT I1([out, retval] I1** prop); }; ///////////////// end /////////////////// Both project A and project B built all right. Now I import A.tlb and B.tlb in project C, and write following code ///////////////// begin ///////////////////// CComPtr < I1> spI1; ///////////////// end /////////////////// compil failed with message error C2872 : "I1" : ambiguous symbol . While what I hope is only one I1, but now there are two. How to resolve this problem?
Since you have
import A.idl
in B.idl, it would be enough to import only B.tlb.«_Superman_» I love work. It gives me something to do between weekends.
-
Since you have
import A.idl
in B.idl, it would be enough to import only B.tlb.«_Superman_» I love work. It gives me something to do between weekends.
Is there any other way to use I1 in B.idl except import? ;P What I really wonder is how to build a software structure like MS Office. In Office, the _CommandBars is in mso.dll, WinWord.Application is in WinWord.EXE, when I import MSWORD.OLB I can find there is code like "virtual HRESULT __stdcall get_CommandBars ( /*[out,retval]*/ struct Office::_CommandBars * * prop ) = 0;" in msword.tlh. How it happens?!! In my projects, I import B.tlb, there is only "virtual HRESULT __stdcall get_I1 ( /*[out,retval]*/ struct I1 * * prop ) = 0;", while I am looking for "virtual HRESULT __stdcall get_I1 ( /*[out,retval]*/ struct A::I1 * * prop ) = 0;"
modified on Saturday, September 26, 2009 11:36 PM
-
I have an interface, I1 declared in library A, I use I1 in library B by writing code like ///////////////// begin ///////////////////// import "A.idl" [ object, uuid(...), ...... ] interface I2 : IDispatch{ [propget, id(1), helpstring("...")] HRESULT I1([out, retval] I1** prop); }; ///////////////// end /////////////////// Both project A and project B built all right. Now I import A.tlb and B.tlb in project C, and write following code ///////////////// begin ///////////////////// CComPtr < I1> spI1; ///////////////// end /////////////////// compil failed with message error C2872 : "I1" : ambiguous symbol . While what I hope is only one I1, but now there are two. How to resolve this problem?