[fpc-pascal]How to copy classes and methods?

Mattias Gaertner nc-gaertnma at netcologne.de
Sun Dec 31 16:15:38 CET 2000


Hi all,

> > I want to create a new class and add/remove methods at runtime.
> > I copy the vmt of an existing class and alter the method table. But I
need
> > to know how big is the vmt of a class?
> > And I have to create published DoNothing procedures. Can I copy the
> > code of an existing procedure? How big is the code of a procedure?

> I also am not sure whether you should try to do so. Copying VMT's is low
> level object pascal. What is it you are trying to accomplish? Why do you
> want to create a new class and add/remove methods at runtime? Maybe
there
> are better ways of doing so.
> 
> Vincent Snijders

I'm writing code for a wysiwyg component editor. (lazarus. Which is open
source, so it should help any other IDE project too).
I'm using TReader, TWriter and the whole RTTI to edit components of unknown
classes. All procedures in the FCL depend on real classes, and not classes
with some fake methods. And because I want to use the FCL, I need a real
class. Thus I create one at runtime and add/remove the methods.
Ok, it is low-lvl object pascal, but it is much easier than rewriting the
FCL.
Therefore...

How big is the VMT of a class?
Can I copy the code of an existing procedure? What is the size of the code
of a procedure?

thx in advance,
Mattias






More information about the fpc-pascal mailing list