Forward declarations for record types

前端 未结 1 1548
挽巷
挽巷 2021-01-13 04:27

Is there such a thing as in the title? I\'m trying to do this in part of converting an API structure, and run into something I haven\'t encountered before:

         


        
相关标签:
1条回答
  • 2021-01-13 05:27

    I think this is the simplest solution:

    PFNReaderTranslatedDispatch = function(var msg: TMsg): BOOL; stdcall;
    PReaderModeInfo = ^TReaderModeInfo;
    PFNReaderScroll = function(prmi: PReaderModeInfo; dx, dy: integer): BOOL; stdcall;
    TReaderModeInfo = record
      cbSize: DWord;
      hWnd: THandle;
      fFlags: DWord;
      prc: PRect;
      pfnScroll: PFNReaderScroll;
      fFlags2: PFNReaderTranslatedDispatch;
      lParam: DWord;
    end;
    

    Indeed, you can clearly reaplce a var parameter by a (by-value) pointer parameter. And there is no problem declaring PReaderModeInfo before TReaderModeInfo.

    0 讨论(0)
提交回复
热议问题