[fpc-devel]A question about old style objects
Pavel V. Ozerski
pavel at insect.mail.iephb.ru
Mon Oct 29 09:31:08 CET 2001
Hello all,
I found in Russian-language forum (FPC community) a question about possibility to use RTTI with
BP-style objects. First my idea was to answer "no" but I made a smallest test:
{$ifdef FPC}
{$smartlink on}
{$typeinfo off}
{$endif}
type
t1=object
constructor Create;
procedure Test;virtual;
end;
t2=object(t1)
procedure Test;virtual;
end;
constructor t1.Create;
begin
end;
procedure t1.Test;
begin
writeln('11111111111111111111111111');
end;
procedure t2.Test;
begin
writeln('22222222222222222222222222');
end;
type
p2=^t2;
var
t:^t1;
begin
t:=new(p2,create);
t^.Test;
end.
I became very surprised when I looked into created .exe file and found in it 11111111111111111111111111 string.
BP7, Delphi 3, Delphi 6 cutted unused t1.test method out from .exe, FPC 1.1 (and also VP 2.1) kept it in .exe.
What is the mean, to keep unused BP-objects methods in .exe although old objects are not designed for RTTI?
Or FPC does support RTTI for these objects? Then, IMHO, it is a unnecessary feature because then old-style
objects will be useless (but in Borland products they are useful because allow to write compact high-optimized
applications; a good demonstration is KOL - free Key Object Library for Delphi).
Sincerely, Pavel
More information about the fpc-devel
mailing list