Recent

Author Topic: [SOLVED] Warning in DirectX headers: inherited method is hidden  (Read 2130 times)

Igor

  • Sr. Member
  • ****
  • Posts: 385
[SOLVED] Warning in DirectX headers: inherited method is hidden
« on: December 27, 2018, 05:38:36 pm »
When I compile DX12.DWrite.pas from DirectX11/12 headers I see several warnings like this one:

Quote
Warning: An inherited method is hidden by: function GetFontCollection(currentPosition: UINT32; out fontCollection: IDWriteFontCollection; out textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;   

https://github.com/CMCHTPC/DelphiDX12/tree/master/Units

Is it safe to simply turn off warnings for this code?

Code: Pascal  [Select][+][-]
  1.     IDWriteTextFormat = interface(IUnknown)
  2.         ['{9c906818-31d7-4fd3-a151-7c5e225db55a}']
  3.         function GetFontCollection(out fontCollection: IDWriteFontCollection): HResult; stdcall;
  4.  
Code: Pascal  [Select][+][-]
  1.     IDWriteTextLayout = interface(IDWriteTextFormat)
  2.         ['{53737037-6d14-410b-9bfe-0b182bb70961}']
  3.         function GetFontCollection(currentPosition: UINT32; out fontCollection: IDWriteFontCollection;
  4.             out textRange: TDWRITE_TEXT_RANGE): HResult; stdcall;
  5.  

Lazarus 1.8.4/fpc 3.0.4, Windows 10 v1809
« Last Edit: December 28, 2018, 08:09:09 pm by Igor Kokarev »

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: Warning in DirectX headers: inherited method is hidden
« Reply #1 on: December 28, 2018, 03:43:58 pm »
The method of IDWriteTextLayout needs to be marked as overload.
Code: Pascal  [Select][+][-]
  1.   IDWriteTextLayout = interface(IDWriteTextFormat)
  2.         ['{53737037-6d14-410b-9bfe-0b182bb70961}']
  3.         function GetFontCollection(currentPosition: UINT32; out fontCollection: IDWriteFontCollection;
  4.             out textRange: TDWRITE_TEXT_RANGE): HResult; overload; stdcall;
  5.  
Delphi compiler consumes both ways: with overload and without it.
(FPC needs a feature update to treat such declaration as overload, at least for {$mode delphi})

Igor

  • Sr. Member
  • ****
  • Posts: 385
Re: Warning in DirectX headers: inherited method is hidden
« Reply #2 on: December 28, 2018, 08:03:25 pm »
Hi,

Thank you! Your solution works fine.

 

TinyPortal © 2005-2018