blob: 9d0604d9d6279a8e5aa438d7e712a22873235f86 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
{ published methods of class helpers are not accessible through the extended
class' RTTI }
program tchlp24;
{$ifdef fpc}
{$mode delphi}
{$endif}
{$apptype console}
type
{$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: Pointer;
begin
f := TTest.Create;
res := f.MethodAddress('Test');
{$ifdef fpc}
Writeln('Address of TTest.Test: ', PtrInt(res));
{$else}
Writeln('Address of TTest.Test: ', NativeInt(res));
{$endif}
if res <> Nil then
Halt(1);
Writeln('ok');
end.
|