, . ( ) IDL , . IDL- , , :
[uuid(753A8A7D-A7FF-11d0-8C30-0080C73925BA)] coclass Gorilla { interface IApe; interface IWarrior; }
IDL- (coclass) (library definition). IDL ( , , , ) . , IDL, . IDL- , Visual Basic Java.
, IDL- , , , :
// apes.idl // bring in IDL definitions of ape interfaces // IDL- import "apeitfs.idl"; [ uuid(753A8A80-A7FF-11d0-8C30-0080C73925BA), // LIBID - version(1.0), // version number of library - lcid(9), // locale ID of library (english) // (english) helpstring("Library of the Apes") // title of library - ] library ApeLib { importlib("stdole32.tlb"); // bring in std defs. - [uuid(753A8A7D-A7FF-11d0-8C30-0080C73925BA)] coclass Gorilla { [default] interface IApe; interface IWarrior; } [uuid(753A8A7E-A7FF-11d0-8C30-0080C73925BA)] coclass Chimpanzee { [default] interface IApe; interface IEgghead; } [uuid(753A8A7F-A7FF-11d0-8C30-O080C73925BA)] coclass Orangutan { [default] interface IApe; interface IKeeperOfTheFaith; } }
[default] , . , , [default] , :
Dim ursus as Gorilla
IDL- Gorilla, :
Dim ursus as IApe
IApe Gorilla. EatBanana SwingFromTree ursus. [default] , coclass.
IDL, apes.h apesitfs.h. apesitfs.h IApe, IWarrior, IKeeperOfTheFaith IEgghead. , apes.h GUID :
extern " " const CLSID CLSID_Gorilla; extern " " const CLSID CLSID_Chimpanzee; extern " " const CLSID CLSID_Orangutan;
apes_i. CLSID. apes.tlb , Visual Basic :
Dim ape As IApe Dim warrior as IWarrior Set ape = New Gorilla ' ask for a new gorilla ' gorilla Set warrior = ape
Java- :
I ; IWarrior warrior; = new Gorilla(); // no cast needed for [default] // [default] ??? warrior = (IWarrior)ape;
CLSID_Gorilla CoCreateInstanceEx , .
IDL IApe, IWarrior, IEgghead IKeeperOfTheFaith . , , . , , . IDL- , IDL- , . IDL- , IDL- , , IDL- , . IDL- , , , . , IDL- , , importlib:
// humans.idl // apeitfs.idl DOESN'T have a library statement, so import // apeitfs.idl HE library, import "apeitfs.idl"; [ uuid(753A8AC9-A7FF-11d0-8C30-0080C73925BA), version(1.0), lcld(9), helpstring("Humans that need apes") // " , " ] library HumanLib { importlib("stdole32.tlb"); // bring in std defs. - // Dogs.idl DOES have a library definition, so importlib // its corresponding type library // Dogs.idl , // importlib("dogs.tlb"); [uuid(753A8AD1-A7FF-11d0-8C30-0080C73925BA)] coclass DogApe { interface IDog; interface IApe; } }
IDL- , , , . , IDL, importlib . , IDL- (IDL-ism) , importlib , . MIDL, , , IDL.