比如以下是在DELPHI的TLB文件 interfaceuses Windows, ActiveX, Classes, Graphics, StdVCL, Variants;
// *********************************************************************//
// GUIDS declared in the TypeLibrary. Following prefixes are used:
// Type Libraries : LIBID_xxxx
// CoClasses : CLASS_xxxx
// DISPInterfaces : DIID_xxxx
// Non-DISP interfaces: IID_xxxx
// *********************************************************************//
const
// TypeLibrary Major and minor versions
Project1MajorVersion = 1;
Project1MinorVersion = 0; LIBID_Project1: TGUID = '{CDF922DC-0A67-4A47-9EEB-B411E18C737C}'; IID_Iyang: TGUID = '{A02B09F2-B295-4DE9-9D8C-C8F0427690DF}';
CLASS_yang: TGUID = '{C3793CC0-BF7C-4CB8-B89B-BAAD9CA5E656}';
type// *********************************************************************//
// Forward declaration of types defined in TypeLibrary
// *********************************************************************//
Iyang = interface;
IyangDisp = dispinterface;// *********************************************************************//
// Declaration of CoClasses defined in Type Library
// (NOTE: Here we map each CoClass to its Default Interface)
// *********************************************************************//
yang = Iyang;
// *********************************************************************//
// Interface: Iyang
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {A02B09F2-B295-4DE9-9D8C-C8F0427690DF}
// *********************************************************************//
Iyang = interface(IDispatch)
['{A02B09F2-B295-4DE9-9D8C-C8F0427690DF}']
end;// *********************************************************************//
// DispIntf: IyangDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {A02B09F2-B295-4DE9-9D8C-C8F0427690DF}
// *********************************************************************//
IyangDisp = dispinterface
['{A02B09F2-B295-4DE9-9D8C-C8F0427690DF}']
end;// *********************************************************************//
// The Class Coyang provides a Create and CreateRemote method to
// create instances of the default interface Iyang exposed by
// the CoClass yang. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
Coyang = class
class function Create: Iyang;
class function CreateRemote(const MachineName: string): Iyang;
end;implementationuses ComObj;class function Coyang.Create: Iyang;
begin
Result := CreateComObject(CLASS_yang) as Iyang;
end;class function Coyang.CreateRemote(const MachineName: string): Iyang;
begin
Result := CreateRemoteComObject(MachineName, CLASS_yang) as Iyang;
end;end.
如果VC要调用这个接口YANG的功能 是不是在VC里面要用C语言重新申明
// *********************************************************************//
// GUIDS declared in the TypeLibrary. Following prefixes are used:
// Type Libraries : LIBID_xxxx
// CoClasses : CLASS_xxxx
// DISPInterfaces : DIID_xxxx
// Non-DISP interfaces: IID_xxxx
// *********************************************************************//
const
// TypeLibrary Major and minor versions
Project1MajorVersion = 1;
Project1MinorVersion = 0; LIBID_Project1: TGUID = '{CDF922DC-0A67-4A47-9EEB-B411E18C737C}'; IID_Iyang: TGUID = '{A02B09F2-B295-4DE9-9D8C-C8F0427690DF}';
CLASS_yang: TGUID = '{C3793CC0-BF7C-4CB8-B89B-BAAD9CA5E656}';
type// *********************************************************************//
// Forward declaration of types defined in TypeLibrary
// *********************************************************************//
Iyang = interface;
IyangDisp = dispinterface;// *********************************************************************//
// Declaration of CoClasses defined in Type Library
// (NOTE: Here we map each CoClass to its Default Interface)
// *********************************************************************//
yang = Iyang;
// *********************************************************************//
// Interface: Iyang
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {A02B09F2-B295-4DE9-9D8C-C8F0427690DF}
// *********************************************************************//
Iyang = interface(IDispatch)
['{A02B09F2-B295-4DE9-9D8C-C8F0427690DF}']
end;// *********************************************************************//
// DispIntf: IyangDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {A02B09F2-B295-4DE9-9D8C-C8F0427690DF}
// *********************************************************************//
IyangDisp = dispinterface
['{A02B09F2-B295-4DE9-9D8C-C8F0427690DF}']
end;// *********************************************************************//
// The Class Coyang provides a Create and CreateRemote method to
// create instances of the default interface Iyang exposed by
// the CoClass yang. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
Coyang = class
class function Create: Iyang;
class function CreateRemote(const MachineName: string): Iyang;
end;implementationuses ComObj;class function Coyang.Create: Iyang;
begin
Result := CreateComObject(CLASS_yang) as Iyang;
end;class function Coyang.CreateRemote(const MachineName: string): Iyang;
begin
Result := CreateRemoteComObject(MachineName, CLASS_yang) as Iyang;
end;end.
如果VC要调用这个接口YANG的功能 是不是在VC里面要用C语言重新申明
COM注册后,其他语言直接就可以调用接口的方法了。