delphi - Forward declarations for record types -
is there such thing in title? i'm trying in part of converting an api structure, , run haven't encountered before:
pfnreadertranslateddispatch = function(var msg: tmsg): bool; stdcall; pfnreaderscroll = function(var prmi: treadermodeinfo; dx, dy: integer): bool; stdcall; treadermodeinfo = record cbsize: dword; hwnd: thandle; fflags: dword; prc: prect; pfnscroll: pfnreaderscroll; fflags2: pfnreadertranslateddispatch; lparam: dword; end; preadermodeinfo = ^treadermodeinfo;
those know delphi see obvious problem. how work around this?
i think 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, can reaplce var
parameter (by-value) pointer parameter. , there no problem declaring preadermodeinfo
before treadermodeinfo
.
Comments
Post a Comment