Order of type definitions |
Top Previous Next |
What is translated > Types > Order of type definitions
In Delphi types can be defined by other types, which aren't defined yet. In C++ a type only can be defined by another type, which is already defined. So the order of the Delphi type definitions has to be rearranged sometimes.
The following example is taken from the ShellApi.pas:
PSHFileOpStructA = ^TSHFileOpStructA; PSHFileOpStructW = ^TSHFileOpStructW; PSHFileOpStruct = PSHFileOpStructA; {$EXTERNALSYM _SHFILEOPSTRUCTA} _SHFILEOPSTRUCTA = packed record Wnd: HWND; wFunc: UINT; pFrom: PAnsiChar; pTo: PAnsiChar; fFlags: FILEOP_FLAGS; fAnyOperationsAborted: BOOL; hNameMappings: Pointer; lpszProgressTitle: PAnsiChar; { only used if FOF_SIMPLEPROGRESS } end; {$EXTERNALSYM _SHFILEOPSTRUCTW} _SHFILEOPSTRUCTW = packed record Wnd: HWND; wFunc: UINT; pFrom: PWideChar; pTo: PWideChar; fFlags: FILEOP_FLAGS; fAnyOperationsAborted: BOOL; hNameMappings: Pointer; lpszProgressTitle: PWideChar; { only used if FOF_SIMPLEPROGRESS } end; {$EXTERNALSYM _SHFILEOPSTRUCT} _SHFILEOPSTRUCT = _SHFILEOPSTRUCTA; TSHFileOpStructA = _SHFILEOPSTRUCTA; TSHFileOpStructW = _SHFILEOPSTRUCTW; TSHFileOpStruct = TSHFileOpStructA; {$EXTERNALSYM SHFILEOPSTRUCTA} SHFILEOPSTRUCTA = _SHFILEOPSTRUCTA; {$EXTERNALSYM SHFILEOPSTRUCTW} SHFILEOPSTRUCTW = _SHFILEOPSTRUCTW; {$EXTERNALSYM SHFILEOPSTRUCT} SHFILEOPSTRUCT = SHFILEOPSTRUCTA;
This is translated to
/*# waiting for definiens typedef TSHFileOpStructA *PSHFileOpStructA; */ /*# waiting for definiens typedef TSHFileOpStructW *PSHFileOpStructW; */ /*# waiting for definiens typedef PSHFileOpStructA PSHFileOpStruct; */ /*$EXTERNALSYM _SHFILEOPSTRUCTA*/
#pragma pack(push, 1) struct _SHFILEOPSTRUCTA { HWND Wnd; UINT wFunc; PAnsiChar pFrom; PAnsiChar pTo; FILEOP_FLAGS fFlags; BOOL fAnyOperationsAborted; void* hNameMappings; PAnsiChar lpszProgressTitle; /* only used if FOF_SIMPLEPROGRESS */ }; #pragma pack(pop); /*$EXTERNALSYM _SHFILEOPSTRUCTW*/
#pragma pack(push, 1) struct _SHFILEOPSTRUCTW { HWND Wnd; UINT wFunc; PWideChar pFrom; PWideChar pTo; FILEOP_FLAGS fFlags; BOOL fAnyOperationsAborted; void* hNameMappings; PWideChar lpszProgressTitle; /* only used if FOF_SIMPLEPROGRESS */ }; #pragma pack(pop); /*$EXTERNALSYM _SHFILEOPSTRUCT*/
typedef _SHFILEOPSTRUCTA _SHFILEOPSTRUCT; typedef TSHFileOpStructA *PSHFileOpStructA; typedef PSHFileOpStructA PSHFileOpStruct; typedef _SHFILEOPSTRUCTA TSHFileOpStructA; typedef TSHFileOpStructW *PSHFileOpStructW; typedef _SHFILEOPSTRUCTW TSHFileOpStructW; typedef TSHFileOpStructA TSHFileOpStruct; /*$EXTERNALSYM SHFILEOPSTRUCTA*/ typedef _SHFILEOPSTRUCTA SHFILEOPSTRUCTA; /*$EXTERNALSYM SHFILEOPSTRUCTW*/ typedef _SHFILEOPSTRUCTW SHFILEOPSTRUCTW; /*$EXTERNALSYM SHFILEOPSTRUCT*/ typedef SHFILEOPSTRUCTA SHFILEOPSTRUCT;
|
This page belongs to the Delphi2Cpp Documentation |
Delphi2Cpp home Content |