[fpc-pascal] Class Memory Table Size

Andrew Haines AndrewD207 at aol.com
Tue May 8 06:39:43 CEST 2007


Hi,

In this page
http://www.freepascal.org/docs-html/prog/progsu139.html#x189-1950008.2.13
in the VMT +0 is the "Size of object type data" and the same number in
the negative is stored at +4. How important is it that this number is
not changed after the object is created? I want to store a number
especially at +0. What is stored after that does not matter.

The reason for this is, I want to trick gtk into thinking that a TObject
is really a GObject. This is where the TypeID for GType's are stored. I
know this won't work for most GObject's, but I am only implementing this
for a GInterface which is looked up by the TypeID, so that is all I need.

I've tested this and it is working. But what horrible things can happen?

Thanks,

Andrew Haines



More information about the fpc-pascal mailing list