[fpc-devel] How to call virtual StoredProc from PropInfo

Ondrej Pokorny lazarus at kluug.net
Wed May 17 19:13:57 CEST 2017


On 17.05.2017 18:13, Ondrej Pokorny wrote:
> My question is, how can I call a virtual stored procedure from PropInfo?

Digging through the code, I found it:

function GetStoredFunction(APropInfo: PPropInfo; AInstance: 
TPersistent): CodePointer;
var
   StoredProcType: Byte;
   xT: Pointer;
begin
   StoredProcType := ((APropInfo^.PropProcs shr 4) and 3);
   case StoredProcType of
     ptStatic: Result:=APropInfo^.StoredProc; // this is fine
*    ptVirtual: Result := 
PPointer(Pointer(AInstance.ClassType))[{%H-}PtrInt(APropInfo^.StoredProc) 
div SizeOf(Pointer)];**
*  end else
     Result:=nil;
   end;
end;

Ondrej
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20170517/498181e7/attachment.html>


More information about the fpc-devel mailing list