On Fri, 12 Nov 2004, Mattias Gaertner wrote:

> 
> I don't know, if this is the right list, but the topic is quite fpc specific 
> and needs some compiler gurus:
> 
> The Lazarus IDE needs to create new classes at runtime. For example when 
> loading/creating a descendent of TDataModule named TMyDataModule, 
> it needs a unique TMyDataModule = class(TDataModule) complete with vmt, 
> method table (empty), field table (empty), typeinfo 
> (no properties), and .. ?
> At the moment lazarus only supports TDataModule and TForm, so I was able to 
> just define the two and copy. 
> But for inheriting I need 'real' custom classes.
> 
> Creating the empty method table, field table and new typeinfo seems to be 
> easy. But I found some fields, which I don't know:
> In objpash.inc there is
>     const
>        vmtInstanceSize         = 0;
>        vmtParent               = sizeof(ptrint)*2;
> 
> The fields behind vmtParent are easy (at least I think so). But what about 
> the 8 bytes (i386) behind vmtInstanceSize and in front of vmtParent?
> They seem to be a negative number and a pointer? What are they are good for?
> 
> And: Is this solution portable or will I get into trouble?

What are you trying to do ? 

As soon as you have the class, you know everything there is to know or that
you need to know. You don't need to have more than the TMyClass class pointer.

In the case of TMyDatamodule, you have the TMyDataModule class pointer, so
You can create an instance and 'show' that on screen ?

For forms you must only assume it is a descendant of TCustomForm.

The Delphi IDE also can only handle things that descend from TCustomForm and
TDatamodule. When registering custom forms or datamodules in the IDE, you 
need to supply Delphi with the actual class pointer, and then it knows what 
to do...

If you want I can show you code that registers custom forms in the Delphi
IDE, I use it myself at work.

Michael.

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

Reply via email to