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:
[EMAIL PROTECTED] dean]$ uname -rs
Linux 2.6.3-7mdk

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

[EMAIL PROTECTED] 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
[EMAIL PROTECTED] 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


_______________________________________________
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to