Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2007-02

Differences between fpc and Delphi regarding COM interfaces declarations

2 messages · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Luiz Americo Pereira Camara

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 PInteger

win32 documentation:
*HRESULT Next( ULONG*/ celt/*,* * 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 assigned

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_ . ;-)

Luiz

Reply by email

Luiz Americo Pereira Camara
to Luiz Americo Pereira Camara
Luiz Americo Pereira Camara wrote 11 lines
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 PInteger win32 documentation: *HRESULT Next( ULONG*/ celt/*,* * FORMATETC_com_FORMATETC **/ rgelt/*,* * ULONG **/ pceltFetched/ *);*

Sorry, i copied formated code. Here's the accurate declaration

HRESULT Next(
ULONG celt,
FORMATETC_com_FORMATETC * rgelt,
ULONG * pceltFetched
);

Luiz

Show quoted text 33 lines
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 assigned 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_ . ;-)

Reply by email