[fpc-pascal] method pointers
Peter Vreman
peter at freepascal.org
Tue Jan 17 07:51:51 CET 2006
> FPC canĀ“t assign value to address, where Delphi can. For example:
>
> TDomNode = class(TDomCustomNode);
> private
> ...
> FUserData : TUtilsWideStringList;
> FUserDataHandlers : TList;
> ...
>
> destructor TDomNode.Destroy;
> var
> I: Integer;
> UserDataEvent: TDomUserDataEvent;
> begin
> // Call user data event handlers:
> if Assigned(FUserData) then
> with FUserData do
> for I := 0 to Pred(Count) do begin
> @UserDataEvent := pointer(FUserDataHandlers[I]);
> if Assigned(UserDataEvent) then
> UserDataEvent(OT_NODE_DESTROYED, WideStrings[I], Objects[I],
> nil, nil);
> end;
> ...
>
> In Delphi, the line
>
> @UserDataEvent := pointer(FUserDataHandlers[I]);
>
> is common practice. What is the difference to FPC and the appropriate
> workaround?
Did you use {$mode delphi} ? If it still fails to compile create a short
example that can be compiled and submit a bug report.
More information about the fpc-pascal
mailing list