![]() |
IInterface Delphi vs VSC
Delphi.
Delphi-Quellcode:
C++
TStreamInfo = record
streamType: TStreamType; ppmt: PAMMEDIATYPE; pdwFlags: Cardinal; plcid: Cardinal; pdwGroup: Cardinal; ppszName: PWideChar; ppObject: IInterface; ppUnk: IInterface; end;
Code:
Bin mir jetzt nicht sicher ob die Übersetzung im Header korrekt ist.
struct TStreamInfo {
TStreamType streamType; AM_MEDIA_TYPE ppmt; unsigned int pdwFlags; unsigned int plcid; unsigned int pdwGroup; wchar_t* ppszName; IUnknown **ppObject; IUnknown **ppUnk; }; C kennt kein IInterface so wie in Delphi oder aber ich finde sie einfach nicht. gruss |
AW: IInterface Delphi vs VSC
IUnknown kennt Delphi auch,
aber fast Egal, da es ein Nachfahre von IInterface ist. Erstmal mußt du auf die Speicherausrichtung achten: Alte Delphis richten Standardmäßig nach "maximal" 4 Byte aus und etwas Neuere nach 8 Byte. Wie im C dort der Standard ist, weiß ich nicht. Also entweder das gleiche Align des C-Compilers explizit für diesen Record oder die ganze Unit einstellen.
Delphi-Quellcode:
{$ALIGN ...}
Oder Packed-Records verwenden. Auf Seite des C auch Packed oder im Delphi mit FüllBytes arbeiten. Speichergrößen: In C++ sind ENUMs/SETs gern so groß wie ein INT und in Delphi so klein wie möglich (meistens Byte und dann Word, LongWord oder UInt64).
Delphi-Quellcode:
{$MINENUMSIZE ...}
|
AW: IInterface Delphi vs VSC
es ging mir um die beiden Einträge.
Code:
ob diese gleichzusetzen sind mit IInterface.
IUnknown **ppObject;
IUnknown **ppUnk; Wenn nicht ist mein Header definitiv falsch übersetzt. gruss |
AW: IInterface Delphi vs VSC
Ja!
|
AW: IInterface Delphi vs VSC
Zitat:
gruss |
AW: IInterface Delphi vs VSC
Zitat:
|
AW: IInterface Delphi vs VSC
Zitat:
War mir nur nicht sicher ob du damit das gleiche gemeint hast. Da steht doch was spätestens dann wenn man eine Quote daraus macht ;) LOL gruss |
AW: IInterface Delphi vs VSC
Zitat aus der System.pas
Zitat:
![]() |
AW: IInterface Delphi vs VSC
Zitat:
So wie das bei IInterface in Delphi ist. also. Ich habe diese Funktionen in der art in meinem Header nicht.
Code:
Wird das in VSC automatisch gemacht wenn ich IUnknown als DatenTyp übergebe?
virtual HRESULT __stdcall QueryInterface(const GUID &IID, void **Obj)
{ return TInterfacedObject::QueryInterface(IID, (void *)Obj); virtual ULONG __stdcall AddRef() { return TInterfacedObject::_AddRef(); } // ... virtual ULONG __stdcall Release() { return TInterfacedObject::_Release(); } gruss |
AW: IInterface Delphi vs VSC
Das ist im IInterface drin.
Bzw. dein Code gehört nicht zum Interface, sondern zur Implementation und da ist es unter Anderem in TInterfacedObject enthalten. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:48 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz