[fpc-pascal] problems with MethodAddress (objpas) fresh cvs build

Dean Zobec dezobec at tin.it
Sun Oct 17 12:49:45 CEST 2004


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 at localhost dean]$ uname -rs
Linux 2.6.3-7mdk

Results:
[dean at localhost 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 at localhost dean]$ tmp/prova
Address of TestSetUp : 0
Address of TestAsString : 0

[dean at localhost 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 at localhost 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





More information about the fpc-pascal mailing list