Open TopPlay opened 6 years ago
Cause the calling convention is stdcall, The 'in' params are casted as call by reference in this case. This is to be compatible to the COM standard. So for FPC the "const" keyword is not necessary. For Delphi I don't know, but I think should be the same behavior.
The C++ const does not exactly behave like Delphi const. However for instance; When pointers to structs are required and alignment is the same, you should use const in the Delphi translation too.
In this case the function should be (At least in Delphi XE7. From Delphi 10.3 Nullable types are introduced):
/// <summary> /// Create a D2D bitmap by copying a WIC bitmap. /// </summary> //<= Delphi 10.2 function CreateBitmapFromWicBitmap(wicBitmapSource: IWICBitmapSource; bitmapProperties: PD2D1_BITMAP_PROPERTIES1 = Nil; out bitmap: PID2D1Bitmap1): HResult; stdcall; //>= Delphi 10.3 function CreateBitmapFromWicBitmap(wicBitmapSource: IWICBitmapSource; bitmapProperties: D2D1_BITMAP_PROPERTIES1 = Nil; out bitmap: PID2D1Bitmap1): HResult; stdcall;
like this:
HRESULT CreateBitmapFromWicBitmap( [in] IWICBitmapSource *wicBitmapSource, [in, optional] const D2D1_BITMAP_PROPERTIES1 *bitmapProperties, [out] ID2D1Bitmap1 **bitmap );
ID2D1RenderTarget = interface(ID2D1Resource) ['{2cd90694-12e2-11dc-9fed-001143a055f9}'] function CreateBitmapFromWicBitmap(wicBitmapSource: IWICBitmapSource;bitmapProperties: PD2D1_BITMAP_PROPERTIES; out bitmap: ID2D1Bitmap): HResult; stdcall;
C++ [in, optional] const<> pascal "const"?