Forward declarations for record types

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:

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 who know Delphi will see the obvious problem. How would you work around this?

Answers


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.


Need Your Help

Updating an arugement of a ModSecurity Core Rule

apache httpd.conf mod-security

I have a big form that probably needs to send 1000 POST DATA arguments at most. Sometimes it would triggers a false alarm from rule 960335 of the OWASP Core rulset. I looked into that rule in

Registering bluetooth reciever Null pointer exception

java android bluetooth nullpointerexception

So right now I am receiving a null pointer exception on registering my receiver. I have used pretty much this same code before with no error and now for some reason I am getting an error. Below is my

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.