Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
fpc-src / usr / share / fpcsrc / 3.0.0 / tests / test / tchlp24.pp
Size: Mime:
{ published methods of class helpers are not accessible through the extended
  class' RTTI }
program tchlp24;

{$ifdef fpc}
  {$mode delphi}
{$endif}
{$apptype console}

type
{$ifndef fpc}
  CodePointer = Pointer;
{$endif}
{$M+}
  TTest = class
  end;
{$M-}

{$M+}
  TTestHelper = class helper for TTest
  published
    function Test: Integer;
  end;
{$M-}

function TTestHelper.Test: Integer;
begin
  Result := 1;
end;

var
  f: TTest;
  res: CodePointer;
begin
  f := TTest.Create;
  res := f.MethodAddress('Test');
{$ifdef fpc}
  Writeln('Address of TTest.Test: ', CodePtrInt(res));
{$else}
  Writeln('Address of TTest.Test: ', NativeInt(res));
{$endif}
  if res <> Nil then
    Halt(1);
  Writeln('ok');
end.