не получает интерфейс через другой
реализация:
| Код | IIntLog = interface ['{1C16826C-231A-4D5C-80D8-9C1E8B63B2DE}'] procedure Log(AStr: String); procedure Save; end;
IExtLog = interface ['{B5C9F863-3B98-4666-8E1D-9637A03384BA}'] procedure Log(AStr: String); stdcall; procedure Save; stdcall; end;
TLog = class(TInterfacedObject, IIntLog, IExtLog) private FCS: RTL_CRITICAL_SECTION; FLog: TStringList; public constructor Create; destructor Destroy; override; { IIntLog } procedure IIntLog_Log(AStr: String); procedure IIntLog.Log = IIntLog_Log; procedure IIntLog_Save; procedure IIntLog.Save = IIntLog_Save; { IExtLog } procedure IExtLog_Log(AStr: String); stdcall; procedure IExtLog.Log = IExtLog_Log; procedure IExtLog_Save; stdcall; procedure IExtLog.Save = IExtLog_Save; end;
constructor TLog.Create; begin inherited Create; InitializeCriticalSection(FCS); FLog := TStringList.Create end;
destructor TLog.Destroy; begin IIntLog_Save; FLog.Free; DeleteCriticalSection(FCS); inherited Destroy end;
...
var lint: IIntLog; lext: IExtLog; begin lint := FLog; lext := lint as IExtLog; // говорит не знает интерфейс IExtLog end;
|
Наверно нужно обработать QueryInterface |