API parameter casts

Top  Previous  Next

What is partially translated > API parameter casts

The Delphi files, which bridge the gap between the Delphi code and the API of the operation system, sometimes are too vague to allow a precise back translation. For example the third parameter of the function SetFilePointer in Winapi.Windows.pas is specified as Pointer:


function SetFilePointer(hFile: THandle; lDistanceToMove: Longint;

  lpDistanceToMoveHigh: Pointer; dwMoveMethod: DWORD): DWORD; stdcall;


The original specification is:






    _In_ HANDLE hFile,

    _In_ LONG lDistanceToMove,

    _Inout_opt_ PLONG lpDistanceToMoveHigh,

    _In_ DWORD dwMoveMethod



The type of the third parameter is specified here as PLONG.  If a void Pointer is passed instead of a PLONG Visual Studio produces the error message:


Conversion of argument 3 from "void *" to "PLONG" is not possible



Another example:


type DWORD = Cardinal;



Delphi2Cpp converts a Cardinal to unsigned int. But it's not possible to assign an unsigned int* to PDWORD or to LPDWORD in C++,



This page belongs to the Delphi2Cpp Documentation

Delphi2Cpp home  Content