Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2004-10

problems with MethodAddress (objpas) fresh cvs build

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Dean Zobec

I'm using some code in objpas to get the names and the addresses of published methods. Lately, in the cvs build, I encountered some problems. See the results of the MethodAddress function in the latest cvs build for example: it cannot get the address of methods (it worked with previous versions):

program prova;
type
{$M+}
  TTestCaseTest = class(TObject)
  published
    procedure TestSetUp;
    procedure TestAsString;
  end;
procedure TTestCaseTest.TestSetup;
begin
  writeln('TestSetup');
end;
procedure TTestCaseTest.TestAsString;
begin
  writeln('TestAsString');
end;
begin
  writeln('Address of TestSetUp : ',
longint(TTestCaseTest.MethodAddress('TestSetUp')));
  writeln('Address of TestAsString : ',
longint(TTestCaseTest.MethodAddress('TestAsString')));
end.

Architecture:
dean]$ uname -rs
Linux 2.6.3-7mdk

Results:
dean]$ cvs/fpc/compiler/ppc386 -Sd tmp/prova
Free Pascal Compiler version 1.9.5 [2004/10/17] for i386 Copyright (c) 1993-2004 by Florian Klaempfl
Target OS: Linux for i386
Compiling tmp/prova.pp
Linking tmp/prova
24 Lines compiled, 0.1 sec
dean]$ tmp/prova
Address of TestSetUp : 0
Address of TestAsString : 0

dean]$ /usr/lib/fpc/1.9.4/ppc386 -Sd tmp/prova
Free Pascal Compiler version 1.9.4 [2004/05/30] for i386 Copyright (c) 1993-2004 by Florian Klaempfl
Target OS: Linux for i386
Compiling tmp/prova.pp
Linking tmp/prova
24 Lines compiled, 0.2 sec
dean]$ tmp/prova
Address of TestSetUp : 134582816
Address of TestAsString : 134582896

I'll try to investigate further to find the reason (any changes in the management of the method table?), meanwhile, if someone has some ideas about what's wrong with it, I'll be grateful for any suggestion Regards,
Dean