Re: Interface Question
- From: Hans-Peter Diettrich <DrDiettrich1@xxxxxxx>
- Date: Wed, 11 Oct 2006 14:24:49 +0200
Rob Kennedy wrote:
I only disagree with the last paragraph(s), about how to retrieve object references. In the case of a Delphi class, the offset of the interface pointer is stored in the interface description, no need to look into the stubs (hint: the compiler obtains the offset just from that place).
How can it be stored in the interface description?
How not? Every Delphi class type contains the descriptions of the interfaces, implemented by this class. These interface descriptions are different for every class!
But there is no class type yet. All we have is an interface reference, and we're trying to get to the object.
The interface reference is a pointer to an pointer to the interface description, from which you can retrieve RTTI as from a class description. The methods may be undocumented, but the RTL contains according data types and procedures. One such information is the offset of the interface pointer within the object, and subtracting that value from the interface reference will turn it into the object reference.
DoDi
.
- References:
- Interface Question
- From: alanglloyd@xxxxxxx
- Re: Interface Question
- From: Rob Kennedy
- Re: Interface Question
- From: Hans-Peter Diettrich
- Re: Interface Question
- From: Rob Kennedy
- Interface Question
- Prev by Date: a problem in my program in pascal
- Next by Date: Re: a problem in my program in pascal
- Previous by thread: Re: Interface Question
- Next by thread: Re: Interface Question
- Index(es):
Relevant Pages
|