[fpc-devel] Differences between fpc and Delphi regarding COM interfaces declarations
Luiz Americo Pereira Camara
pascalive at bol.com.br
Sat Feb 3 16:19:00 CET 2007
Luiz Americo Pereira Camara wrote:
> While porting some Delphi code i found some differences in the
> declarations of COM interfaces.
> 1) In IEnumFORMATETC.Next(Celt:ULong;Out Rgelt:FormatEtc;Out
> pceltFetched:ULong):HResult; Delphi expects pceltFetched to be a
> win32 documentation:
> *HRESULT Next( ULONG*/ celt/*,* * FORMATETC_com_FORMATETC **/
> rgelt/*,* * ULONG **/ pceltFetched/ *);*
Sorry, i copied formated code. Here's the accurate declaration
FORMATETC_com_FORMATETC * rgelt,
ULONG * pceltFetched
> Delphi code:
> function Next(celt: Integer; out elt; pceltFetched: PLongint): HResult;
> My adapted code (Based in activex unit - required to compile):
> function Next(celt: LongWord; out elt: FormatEtc; out pceltFetched:
> LongWord): HResult;
> There are two questions:
> - Should fpc adapt the code to be delphi compatible??
> - Calling this interface from fpc is not allowed to pass a nil
> parameter in pceltFetched, but it would be possible calling from
> outside?? C++? (The win32 docs does not specify)
> I'm asking this because the original code checks if pceltFetched is
> 2) In the STGMEDIUM definition fpc has the following fields
> PUnkForRelease, PSTM, PSTG while delphi has UnkForRelease, STM, STG.
> First i think that fpc translated the win headers wrongly, but after
> looking for the original code declaration i found that fpc is
> following win32 api closely (with the "P")
> - What todo here: stay with win32 api or goto Delphi?
> Notice that this is only a matter of nomenclature and renaming them
> was sufficient to fix the code, but i took sometime anyway.
> PS: I'm documenting all the differences i found and i pretend to
> create a database with the differences between Delphi and fpc/Lazarus.
> I'll publish it ASA_F_ . ;-)
More information about the fpc-devel